-
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
Cleanup ZonedDateTime & OffsetDateTime Spec #145
Conversation
I’m not sure it’s “just” as easy; it means you have to know to chain off the instant. It’d be ideal imo if everything had a withZone convenience method directly. |
The question then is what happens if the offset doesn’t match? Is that an error or should it be just a convenience version for odt.instant.withZone() how about the same thing on ZonedDateTime ? Should that be there? Should that do a timezone conversion? I have no objection to keeping it, I just didn’t want to come up with a consistent rule here. If a few people chime in, I’m happy with adding it back in (separate PR/will create an Issue when merging) |
There are potentially at least two issues with
Having such a method only work when the new zone agrees with the existing object fields doesn't seem very useful to me because the window is so tight, but allowing disagreement seems likely to be confusing for the authors with different intuitions about our choice of data priority. I think I agree with @pdunkel that the method should be omitted, which means updating my mental model such that OffsetDateTime is not a hierarchical parent of ZonedDateTime, but rather more like a fraternal twin that exposes the same getters.
This is a separate question, essentially regarding reification of the class hierarchy. The primary purpose of a A complete reification would already be broken by including |
I'm not overly familiar with Regardless of the specific names (I won't rehash what @jodastephen has already said in #33), I think having 2 separate methods to remove the potential ambiguity is not a bad thing. |
So we are back to a fight over names that make things less obvious. I'd personally go with: and
which makes it entirely obvious what to do and is no more complex than funcily named convenience methods that besides naming being less obvious since they pretend it's all about the zone rather than the base of what to combine with the zone. |
I'll merge this for now. To get to a coherent base state to write more spec-text. |
Basic cleanup of the spec to closer match
objects.md
.Changes
Eliminate
OffsetDateTime.prototype.withZone
Reason is that it's just as easy to
offsetdatetime.instant.withZone()
which is much more explicit.