1.1.4 • Published 6 years ago

angular-timezone-select v1.1.4

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

Timezone select for AngularJS

A simple AngularJS directive to create timezone select. It uses select2 to create auto-complete timezone select. Timezone information comes from moment. Countries timezone data comes from TimezoneDB.

In the dropdown, timezones are divided into three groups:

  • UTC - UTC is a common option for most users.
  • Common - Timezones for a country
  • Other - Other timezones

If the user has already selected the country, timezones for the country will be listed first, which makes easier for user to select.

Install

Install angular-timezone-select using Bower bower install angular-timezone-select.

Usage

Make your Angular module depend on module angular-timezone-select.

angular.module('timezoneSelectExample', ['angular-timezone-select']);

Then use directive timezone-select.

<select timezone-select data-ng-model="timezone" data-country="country"></select>

Attribute country can be used to bind user's selected country. Value of selected country should be the ISO 3166-1 alpha-2 code, e.g. CN, US.

See example.html for a simple example.

Translations

You can provide different Translations for timezone groups. See table below.

AttributeDefault value
i18n-utcUTC
i18n-commonCommon
i18n-otherOther

For example,

<select timezone-select data-ng-model="timezone" data-country="country" data-i18n-common="Common Timezones"></select>