dimanche 25 mars 2018

Time zone with day light savings in Ruby on Rails

I am working on an application where appointments were scheduled based on the availability of the user.

The user will choose their availability like "10:00 AM". I am going to store these availabilities in UTC in my database by converting it from users time zone to UTC. Say for example "10:00 AM" EST will get stored as "15:00" in UTC. So that I can show the availability of the user to the consumer by converting it from UTC to browsers time zone which is consumers timezone.

I am really confused of how to handle the day light savings while storing the availability of the user.

For example if the user chooses the time "10:00 AM" with daylight savings it will be stored as 14:00 in UTC and without day light savings it will be stored as 15:00.

For your information I am going to use the availability of the user based on day. i.e on Monday I will be available on "10:00 AM", "12:00 PM".

How can I handle this situation?

Aucun commentaire:

Enregistrer un commentaire