-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimeZone.from
and ISO "Z" strings
#1075
Comments
Meeting, Oct 29: The above code is not necessarily a bug but may occur in upgrade paths. We'll keep TimeZone.from as is, where accepting an ISO string with |
After the meeting, @ptomato and I agreed on the following fallback position:
In other words, the rationale throwing from "Z" strings with a bracket suffix in ZDT.from should be that "Z" strings simply aren't accepted, rather than because they conflict with the IANA bracketed zone. |
In #313, it was decided that ISO
Z
strings would be accepted byTimeZone.from
. We may want to revisit this, for the same reason that ZonedDateTime.from doesn't accept bracketless ISO strings: because it makes it too easy for developers to perform calendar operations or ZDT math in the UTC time zone. Instead developers should should be using theTemporal.Instant
type and not trying to pretend that their Instant is really a ZonedDateTime.If developers find themselves wanting to operate on months or to add calendar days or months, then they need a real time zone! (Or if they really want UTC, they should opt in via
'UTC'
).Example:
Anyway, my suggestion would be to stop accepting ISO "Z" strings in TimeZone.from.
The text was updated successfully, but these errors were encountered: