Date/Time in DB & API: Time Zone Aware & UTC #16
jacob-a-brown
started this conversation in
ADR
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Decision
All date/time objects & fields are to be time zone aware and stored/handled in UTC.
Benefits
This greatly simplifies both the API and storage because
Implementation
Backend
Pydantic
AwareDatetime
fields (which is imported from Pydantic).Database
timezone=True
(e.g.DateTime(timezone=True)
andTIMESTAMP(timezone=True)
).service_default=func.timezone("UTC", func.now())
to ensure the recorded values are in UTC.Frontend
Because all date/time fields will be converted to UTC if not already provided as UTC, the frontend can in theory send data in any time zone. Nevertheless, to help ensure data validity and quality the frontend should always send date/time info in UTC.
The frontend will receive all date/time information in UTC, so it must convert it to the appropriate time zones for display and interaction (likely Mountain Time for NMBGMR products).
Beta Was this translation helpful? Give feedback.
All reactions