holman / ama

Ask @holman anything!
731 stars 277 forks source link

UTC is Enough for Everyone, right? #866

Closed backeseduardo closed 4 years ago

backeseduardo commented 4 years ago

Hello @holman, how you doing? I've watched and read your article "UTC is Enough for Everyone, right?". I'm currently trying to figure out what is the best way to support different time zones, the caveat is we store past dates and future dates. Should we save the date in utc and save user's local date? What is the best strategy for future dates?

holman commented 4 years ago

Depends! (Everyone's favorite answer!)

It really depends on how you use them. I think for most people you're probably fine just storing UTC and going from there- it's not thatttt big of a deal if there are weird timezone/DST shifts that might end up with incorrect data later on. Making a calendar, for example, you might want to worry a lot more about the current location/tz/other info and storing that with the date representation at the time, since a lot of that could feasibly change over the years. But yeah, depends!