-
Notifications
You must be signed in to change notification settings - Fork 152
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
Possibly combine (Instant + ZonedDateTime => Absolute) #156
Comments
Some people argued against me pretty strongly when I made a similar suggestion. How do you propose addressing the serialization variance ("2019-09-12T21:19:00.000000000Z" for Instant vs. "2019-09-12T21:19:00.000000000+00:00[Etc/UTC]" for ZonedInstant)? And how does everyone feel about |
Etc/UTC isn’t actually real. UTC alone is canonical. I’m thinking: UTC serialises with Z as for plus/minus Absolute adds time as relative to the absolute timeline; so that adding P86499S over a DST change would NOT be the same as adding P1D which is exactly the point. It is also why we wanted a combined type to begin with. |
This is Luxon's model and it works quite well. The main downsides seem to be:
Neither of these are very compelling disadvantages, IMO, and just amount to some extra properties you might not need. And in particular, I think it would be super weird if |
You've got it backwards, UTC is an alias for the canonical Etc/UTC. And I'm not comparing |
I got you right, but explained badly: The process in Absolute for plus is to add the time bits directly as nanosecondsEpoch, since that’s a stable relationship; then add the date bits to the resultant datetime and calculate the nanosecondEpoch. This way adding time bits respects DST changes while DateTime does not. https://github.com/std-proposal/temporal/blob/absolute/lib/absolute.mjs#L113 |
Conclusions: I've spent a lot of time talking to people about this and getting back to some of the people that suggested this. It turns out this isn't really a good idea and makes things a lot more confusing. Also what was suggested in #139 isn't this either, on the contrary, this makes things worse. So while the experiment / thought process was fully worth it in terms of exploring, this is NOT the way we should take things. |
I've been thinking hard about the number of classes we have and whether all of them are strictly necessary. Part of this was an exploration of whether there is any real value in having distinct classes for
Instant
andZonedDateTime
.I've explored what this would mean in this branch of the polyfill and actually quite like it.
The rationale for having
Instant
was to have a clear mental model and distinction between absolute timeline things and just day/month/year/hour/min/sec/...However that left
ZonedDateTime
being an unholy exception to everything. By opting for combining them, it becomes a bit simpler. And appears a bit more user-friendly, while still giving the full-spectrum of capabilities.This is to gather opinions to check if this is a direction of thought worth continuing down. So please throw all the arguments at me for keeping them separate!
The text was updated successfully, but these errors were encountered: