One issue with web development is that your applications are immediately available to the world. As such, you want your application to work well for whoever is using it, and a big part of who someone is, is where they live.
Where you live determines what language you speak, what units you measure with, etc. Another important aspect of location is time, and the fact that each location has its intricacies about how it deals with time, whether it be timezones, daylight savings, or what day the week starts.
TimezoneJS creates a new TimezoneJS.Date object which has native timezone support using Olson TZ data files. Although it requires you to use a new Date object, its quite helpful in enabling the use of any timezone you want, as long as you keep those timezone files up to date.
Obviously, using both of these standalone is possibly, but switching between objects can be cumbersome, so I began the process of making Datejs work for the TimezoneJS.Date object.
For this to work, simply use TimezoneJS, add a culture file from Datejs’s repo, and add timezone-js-sugar. The timezone-js-sugar package is simply a port of Datejs’s core, but gives you a bunch of helpful helpers and pretty date printing.
- timezone-js require Fleegix out of the box, however, you can also use it with jquery just by adding the timezone-js-jquery add on
- I’ll be making some bug fixes to timezone-js at here