Time is an illusion but TimeZones are not.

Timezone configuration and management on the browser has never been easy. Here is some insight from Rishi

Learning shall never stop..!!!

Recently I have been working on handling timezones on a client project. Front end is AngularJs 1.3 and backend api is Rails api.

It is a very common scenario. User chooses what timezone the data should be displayed in. Api saves and returns all the dates in UTC format.

There are also a lot many client side validations comparing saved time with local time (in all permutation and combinations possible).

Tools used:

  1. Javascript Date object:

    While working with timezones, it is always good to know that Javascript Date object is always in local time zone. There is no direct option to set the timezone. You can change time by adding/subtracting timezone offset.

  2. moment.js: moment is a javascript library which provides pretty options to format the moment date object which is not possible with javascript Date object.
  3. moment-timezone.js: This library allows you to convert moment time object in…

View original post 311 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.