Better Timezone
A jQuery plugin for making sane timezone selects. - Fork with latest version
This jQuery plugin creates a simple, configurable dropdown and autocomplete element. For some reason, this hasn't really been solved yet. Timezones are pretty weird and vary year to year, so we've compiled and cross-checked several different data sources:
- IANA timezone database
- Microsoft timezone database
- Unicode Common Locale Data Repository
Dependencies
Plugin Size
~20kb total
Fork updates
So far, version update to 0.0.5. In the future:
- Fix default timezone pick to new Intl API.
- Better configuration
Usage
- Include jQuery and Select2:
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.1/css/select2.min.css" rel="stylesheet" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.1/js/select2.full.min.js"></script>
- Include plugin's code:
<script src="dist/better-timezone.min.js"></script>
- Include your target element:
<select id="element">
<option value="" disabled selected>Please select a timezone</option>
</script>
- Call the plugin:
$("#element").betterTimezone({
showIANA: false,
showOptgroups: false
});
Options
showIANA
Boolean: make better-timezone include all IANA classification geolocations.
showOptgroups
Boolean: make better-timezone group IANA locations into their respective timezone categories with <optgroup>
elements. Cannot be true when showIANA is false
Contributing
Check CONTRIBUTING.md for more information.
History
Check Releases for detailed changelog.
License
The MIT License (MIT)
Copyright © 2015 Clara Labs, https://www.claralabs.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.