Skip to content

AngularJS features for TimezoneJS-enhanced JavaScript Date objects.

License

Notifications You must be signed in to change notification settings

MarkJessop/angular-timezones

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timezones for AngularJS Build Status

AngularJS features for TimezoneJS-enhanced JavaScript Date objects.

Deprecation Notice

This project will not receive additional features, bug fixes, or any other maintenance, and the project will be deleted on January 1, 2015. If you wish to continue development or work with more active projects where issues might be resolved, please see forks.

Inclusion

Bower

Bower users can add the following to their package dependencies. Be sure to see tags for a list of available versions.

{
  "dependencies" : {
    "angular-timezones" : "git@github.com:michaelahlers/angular-timezones.git#0.3.8"
  }
}

Usage

After including angular-timezones.js, add this package to your application.

var yourApplication = angular.module('your-application', ['Timezones'])

Configuration

This package provides the IANA timezone data, but you may have this resource served from a different location or you wish to provide your own data. To change that location, set the $timezones.definitions.location property to the appropriate path or URL.

yourApplication.constant('$timezones.definitions.location', '/custom/path/to/tz/data')

This is done by the unit tests and illustrated in docs/examples.

Resolution

The $timezones.resolve(timezone, reference) function will, using the reference Date provided, look up complete details about the timezone—including the abbreviation, offset, and decomposed region and locality. This is useful for avoiding clever tricks to extract abbreviations from Date.toString (which is not particularly portable or robust). Additionally, resulting values are derived from the authoritative IANA timezone data.

Detection

If jsTimezoneDetect is included, the $timezones.getLocal() function will detect the browser's local timezone and provide a complete definition that's resolved against the IANA database.

Examples

See docs/examples for demonstrations of these features. As timezone data (found in tz/data) must be served from a web server, these examples will not work from the local disk. However, there is a quick solution for most platforms: the files can be served with Python's SimpleHTTPServer.

python -m SimpleHTTPServer

Once running, visit http://localhost:8000/ in your web browser, and navigate to the examples folder.

Developers

Timezones for Angular is tested with Karma and PhantomJS against the latest available release of jQuery (2.0.0) and AngularJS (1.1.4).

With NPM installed, you can test your modifications with the following.

npm install
npm test

Acknowledgements

This project was originally forked from angular-timezone-js by Tomas Ruzicka.

Timezone data provided by IANA (extracted from tzdata2013c.tar.gz).

About

AngularJS features for TimezoneJS-enhanced JavaScript Date objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Makefile 57.7%
  • JavaScript 40.2%
  • Shell 2.1%