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

Temporal.Time.prototype.difference should not exceed PT12H #330

Closed
gibson042 opened this issue Jan 25, 2020 · 0 comments · Fixed by #386
Closed

Temporal.Time.prototype.difference should not exceed PT12H #330

gibson042 opened this issue Jan 25, 2020 · 0 comments · Fixed by #386
Assignees

Comments

@gibson042
Copy link
Collaborator

difference methods return the absolute difference between the receiver and the argument, regardless of how they compare with each other. And since time of day is modular, such comparison isn't even possible without an attached day (e.g., 10:00 is earlier than 23:00 on the same day, but later than 23:00 on the preceding day). Inferring same-day semantics makes sense for compare, but seems wrong for difference—why should 10:00 vs. 23:00 get reported as PT13H while the equal span 11:00 vs. 00:00 gets reported as PT11H? In general, why should output values greater than PT12H be possible output only when one input value happens to be in the first half of a day?

Consistent comparison-ignoring results from difference should include proper modular arithmetic for Temporal.Time values, in which no two values can be separated by more than 12 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants