I have a web app with an ASP.NET API back-end and React front-end. It also has a mobile app built in React Native.
Question is about date/time values. I have two options in handling time zone conversions and wanted to get some opinions on which is a better approach.
- I can store user's time zone in the database and send all date/time values already converted to user's time zone -- based on the saved time zone data. The advantage of this approach is that the front-end doesn't have to do any work. This is an advantage especially for older smart phones with limited system resources.
- Second option is to send UTC values to the React front-end as well as the mobile apps and let JavaScript handle the work of displaying date/time values based on user's time zone that it captures in runtime. The advantage of this approach is that JavaScript captures the user's time zone in real time and can be more precise. For example, user may tell me that he/she is in US Eastern Time Zone but then travel to California i.e. US Pacific Time Zone. I guess letting JavaScript handle the time zone data may eliminate the worry created by user traveling to another time zone.