Skip to content
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

Closed
ptomato opened this issue Sep 15, 2020 · 4 comments
Closed

Adjustments to rounding options in difference() and round() methods #908

ptomato opened this issue Sep 15, 2020 · 4 comments
Assignees
Labels
documentation Additions to documentation non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! spec-text Specification text involved

Comments

@ptomato
Copy link
Collaborator

ptomato commented Sep 15, 2020

Follow-up from #827.

Two questions I'd like to open that arose after implementing the rounding proposal:

  1. absolute.round({ smallestUnit }) allows "minutes" for smallestUnit 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.

  2. We don't have rounding in Temporal.Date.prototype.difference and Temporal.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.

@ptomato ptomato added this to the Stable proposal milestone Sep 17, 2020
@ptomato ptomato added documentation Additions to documentation spec-text Specification text involved non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! labels Sep 18, 2020
@justingrant
Copy link
Collaborator

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.

@ptomato
Copy link
Collaborator Author

ptomato commented Oct 7, 2020

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.

@justingrant
Copy link
Collaborator

BTW, my strong preference for (1) above would be that Instant should support 'hour', not that we should remove 'hour' and 'minute'. Convenience trumps purity in this case.

ptomato added a commit that referenced this issue Oct 13, 2020
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
ptomato added a commit that referenced this issue Oct 13, 2020
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
ptomato added a commit that referenced this issue Oct 13, 2020
For the same reason as we can add it to Date.difference, `this` is used as
the reference point.

See: #908
ptomato added a commit that referenced this issue Oct 13, 2020
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
ptomato added a commit that referenced this issue Oct 13, 2020
For the same reason as we can add it to Date.difference, `this` is used as
the reference point.

See: #908
@ptomato ptomato self-assigned this Oct 14, 2020
Ms2ger pushed a commit that referenced this issue Oct 14, 2020
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
Ms2ger pushed a commit that referenced this issue Oct 14, 2020
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
Ms2ger pushed a commit that referenced this issue Oct 14, 2020
For the same reason as we can add it to Date.difference, `this` is used as
the reference point.

See: #908
@ptomato
Copy link
Collaborator Author

ptomato commented Oct 14, 2020

Both of these were addressed.

@ptomato ptomato closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Additions to documentation non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! spec-text Specification text involved
Projects
None yet
Development

No branches or pull requests

2 participants