roggervalf / react-appointment-picker

React component to pick an appointment
MIT License
10 stars 13 forks source link

Displaying time in GMT instead of local timezone on IOS device #8

Closed vickyintokyo closed 4 years ago

vickyintokyo commented 4 years ago

Hi There, This component works perfectly on the Chrome, Firefox mobile emulators perfectly. But when i check it on the real mobile device it is showing as Invalid date. My gut feeling is it is due to you are using normal date object whereas IOS specifically needs ISO date format. Can you please look into this?

vickyintokyo commented 4 years ago

Apologies found out the reason for invalid date. So please ignore above comment. But then i have different issue now. On all mobile emulators AppointmentPicker is properly taking local timezone when i pass date object ("2020-05-28T11:00:00). But when i access it on IOS device it is converting the time specified for Initialday prop to GMT. So in above case it displays 08:00:00PM. My local timezone is +09:00GMT. Thanks for your help

roggervalf commented 4 years ago

Hi @vickyintokyo, maybe this links could help: https://www.digitalocean.com/community/tutorials/understanding-date-and-time-in-javascript https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript setting your locale that you are expecting could help. Let me know how it works.

vickyintokyo commented 4 years ago

@roggervalf Thanks for the links. I couldnt get it IOS and desktop working with the one single way of creating date object. So I think i will use the screen size to decide how to create the date object. That will solve the issue for time being. But i was looking for a single way of handling IOS and desktop. I really appreciate your help though. Thanks much.