Support ISO 8601 extended by time zone name
Grannath opened this issue · comments
Many libraries support an extended form of the ISO 8601 standard which includes time zone information in addition to the offset.
2017-01-02T06:12:38+01:00 [Europe/Berlin]
This fills a hole in the standard, as there is no official way to include time zone information.
I have already implemented a parsing function to read the time zone name. It's just a simple regex. Additionally I would propose to modify the existing parser to ignore time zone names if found.
Depending on your feedback, I'd open a pull request and get started.
EDIT: After reading the parser code and checking back with the documentation, I think there should be a clarification.
fromISO8601 parses an ISO8601-formatted date time string into a DateTime object, adjusting for its offset.
The later actually means "converts the date and time to UTC", which is not clear, at least for me. The type DateTime
also does not talk about time zones. Seeing how the parser works, it is supposed to be used for UTC values only?
Agree on the documentation clarification. I misinterpreted this, and it took a little while to discover the source of our "off by one hour" bug.
As do I.
Still trying to figure out exactly when to use DateTime
and when to use ZonedDateTime
.
Am archiving this repository which recommends closing this issue