Skip to catalogue

266

UTC vs local time

also timezone, DST, civil date

Store an instant in UTC. Store a birthday as a date. Do not confuse the two.

What is UTC vs local time?

An instant is a point on the timeline. Store it in UTC, or with an explicit offset. A civil date, such as a birthday or a store’s opening day, has no zone and must not be converted through one. Local wall time needs a zone id, because “2:30” does not exist on the DST spring-forward morning and happens twice in the fall.

Why does UTC vs local time matter when vibe coding?

The draft saves a timestamp without a zone, or it stores the user’s local time as if it were UTC. Reports shift by hours. A birthday becomes the day before for anyone west of the server.

How do you do UTC vs local time?

Instants in UTC. Civil dates as dates. Convert to a zone at the edge, with the zone id stored if you need that wall time again. Test a DST gap.

How do you ask a model for UTC vs local time?

Store (event time) as a UTC instant. Store (birthday) as a date with no zone. Convert to the user zone only when rendering. Do not store local wall time without a zone id. Handle the DST gap.

What goes wrong with UTC vs local time?

Truncating a UTC instant to a date on the server. The user’s local date is a different day.

adjacent