0
Answer

handle UTC storage and user-specific time zone rtrival

I have built a calendar application where events are saved in the database in UTC format (the column type is datetime2(7)).

When retrieving events, I convert the UTC time to the user’s browser time zone on the frontend using React.

However, I am facing issues because sometimes the time zone offset is EST (UTC-5) and sometimes EDT (UTC-4), depending on daylight saving time.

Since users of the application can be in different time zones such as IST, UTC, EST, etc., the application is failing during date comparisons due to time zone differences and daylight saving changes.

What should be the correct approach to handle time zones and date comparisons properly in this scenario?