-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document timestamp architecture decisions (#535)
Co-authored-by: Bess Sadler <[email protected]>
- Loading branch information
1 parent
1790dfa
commit af21b7b
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 5. Timestamps | ||
|
||
Date: 2024-02-22 | ||
|
||
## Status | ||
|
||
Decided | ||
|
||
## Context | ||
|
||
We want to ensure that all timestamps are recorded and displayed in the same time zone and in iso8601 format: "2024-02-22T13:57:19-05:00". However, Mediaflux requires that timestamps be in a different format: "22-FEB-2024 13:57:19" | ||
|
||
## Decision | ||
|
||
Time zones should be recorded using the America/New York zone, NOT EST, because EST will change depending on the time of year. Additionally, the [ruby `Time` class](https://ruby-doc.org/3.3.0/Time.html) should be preferred over the `DateTime` class because the `Time` class covers concepts of Daylight Savings time. | ||
|
||
We will record the iso8601 timestamp in the database and this is what we will always display to the user. When we send data to Mediaflux, we will transform this timestamp to what Mediaflux expects. | ||
|
||
### Examples | ||
|
||
Parsing a timestamp from MediaFlux: | ||
``` | ||
Time.zone.parse(@last_modified_mf).in_time_zone("America/New_York").iso8601 | ||
``` | ||
|
||
Recording the current timestamp: | ||
``` | ||
Time.current.in_time_zone("America/New_York").iso8601 | ||
``` | ||
|
||
Transforming iso8601 into Mediaflux format: | ||
``` | ||
ProjectMediaflux.format_date_for_mediaflux(project.metadata[:updated_on]) | ||
``` |