DEV Community

[Comment from a deleted post]
Collapse
 
xowap profile image
Rémy 🤖

"Always store in UTC"

Well, wrong. Suppose that you allow users to have intents like "every Monday at 9am", you need to adapt to DST.

To me the golden rule is:

  • Date (including time)
  • Time zone
  • Time offset

Depending on your needs you need to pick two. The third can be deducted (in most cases).

Rule of thumb to choose:

  • If you're referring to an immutable event, then pick "time offset"
  • If you're expressing an intent ("wake me at 7am") pick "time zone"

Please note that timestamps and UTC dates are equivalent to picking the offset.

Does my explanation make sense?