Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Support upcoming RFC 9557 timestamp format

71 views
Skip to first unread message

Mathieu

unread,
Sep 11, 2024, 11:55:57 PM9/11/24
to elixir-lang-core
A new standard format to represent date times including time zone information is coming. Just a quick post to raise awareness and help prepare if we wish to support this:)

Issue with ISO 8601:
ISO 8601 only allows passing the offset, losing daylight saving time information. Additional information may be added, such as the calendar system.

Example RFC 9557 string:
1996-12-19T16:39:57-08:00[America/Los_Angeles]

Valid RFC 3339 strings (e.g., 1996-12-19T16:39:57-08:00) are also valid RFC 9557 strings.

Inconsistencies:
1.   2022-07-08T00:14:07+01:00[Europe/Paris]
Europe/Paris used a time zone offset of +2 in July 2022, not +1.

2.   2022-07-08T00:14:07+01:00[!Europe/Paris]
Same timestamp text but using the critical flag, indicating applications must act on the inconsistency.

3.   2022-07-08T00:14:07Z[Europe/Paris]
In combination with a time zone identifier, Z indicates an unknown local offset and local time. Therefore the timestamp text above is NOT inconsistent. The time is n UTC and is known, the time zone is Europe/Paris, but we do not know the local time and offset in Europe/Paris for this instant.

Source:
https://www.rfc-editor.org/rfc/rfc9557.html

I can see us adding a new `to_rfc9557` function in DateTime and a new `parse_datetime` function in Calendar.ISO accepting timestamps including the time zone identifier, which queries the time zone database for non-UTC timestamp formats.

Reply all
Reply to author
Forward
0 new messages