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:
- 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.
- 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.
- moment-timezone.js: This library allows you to convert moment time object in…
View original post 311 more words