-
Notifications
You must be signed in to change notification settings - Fork 149
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
Adjustments to rounding options in difference() and round() methods #908
Comments
Both these proposed changes sound good to me. Should this be in the design-decisions milestone or the current Stable Proposal milestone? I admit I don't fully understand the difference between the two. |
The design-decisions milestone is what I'm currently using as the agenda for our meetings, it needs to be emptied out ASAP. I think these are probably uncontroversial enough that we don't need to spend meeting time discussing them. |
BTW, my strong preference for (1) above would be that Instant should support |
The rationale for not allowing this was that the starting point of the hour was not well-defined, due to Instant not having a time zone. However, this applies to minutes as well, and so hours and minutes should either be both allowed or both disallowed. We decide to allow them for convenience. See: #908
We don't have Date.round because calendar rounding needs a reference point, but in Date.difference we have a reference point (`this`). See: #908
For the same reason as we can add it to Date.difference, `this` is used as the reference point. See: #908
We don't have Date.round because calendar rounding needs a reference point, but in Date.difference we have a reference point (`this`). See: #908
For the same reason as we can add it to Date.difference, `this` is used as the reference point. See: #908
The rationale for not allowing this was that the starting point of the hour was not well-defined, due to Instant not having a time zone. However, this applies to minutes as well, and so hours and minutes should either be both allowed or both disallowed. We decide to allow them for convenience. See: #908
We don't have Date.round because calendar rounding needs a reference point, but in Date.difference we have a reference point (`this`). See: #908
For the same reason as we can add it to Date.difference, `this` is used as the reference point. See: #908
Both of these were addressed. |
Follow-up from #827.
Two questions I'd like to open that arose after implementing the rounding proposal:
absolute.round({ smallestUnit })
allows"minutes"
forsmallestUnit
but not"hours"
. The reason for this was that hours are not defined in an Absolute and would need a time zone-aware reference point. But this seems inconsistent. If hours are not well-defined, then neither are minutes. Currently rounding to minutes uses the Unix epoch as 0 minutes, and you can get the same effect as rounding to 1 hour by specifying minutes with an increment of 60. I think we should either have both hours and minutes, or neither.We don't have rounding in
Temporal.Date.prototype.difference
andTemporal.YearMonth.prototype.difference
, but there's nothing actually preventing this. We decided not to do date rounding in the round() method because you need a reference point, but in difference() you have a reference point.The text was updated successfully, but these errors were encountered: