Local vs. Absolute

Local vs. Absolute

Tempo provides two kinds of datetime types: local and absolute. But what’s the difference? Why would you use one over the other?

Local

Local dates and times are types without time zones. They rely on external context to provide meaning. Think of them like a physical clock or a calendar. Nobody asks what time zone a wall clock is displaying—it’s obvious from the location of the clock and the observer.

Use them when the time zone is obvious from the context, or it would add unnecessary complexity. For example:

  • Personal reminders
  • Alarm clocks
  • Bus schedules

Absolute

Unlike the local classes, absolute datetimes are tied to an exact moment of time in UTC, and to a specific location or time zone. (In the case of Instant, that time zone is UTC itself).

Use them when the time zone is not obvious, when coordinating between different geographic locations, or whenever a local time would be ambiguous. For example:

  • Video chat or conference call schedules
  • Shared calendars
  • Log timestamps (Instant in particular)