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.PlainDate.compare sometimes doesn't give 0 for the same date #1199

Closed
Louis-Aime opened this issue Nov 16, 2020 · 1 comment · Fixed by #1266
Closed

Temporal.PlainDate.compare sometimes doesn't give 0 for the same date #1199

Louis-Aime opened this issue Nov 16, 2020 · 1 comment · Fixed by #1266
Assignees
Labels
documentation Additions to documentation
Milestone

Comments

@Louis-Aime
Copy link

Let's have one and two as the same date in two different calendars (possibly one custom and one built-in).
Then Temporal.PlainDate.compare(one, two) will not yield 0, but rather 1 or -1.

You solve by adding a common calendar, e.g.
Temporal.PlainDate.compare(one.withCalendar("iso8601"), two.withCalendar("iso8601"))
which adds some more burden to what @justingrant already mentionned in #1086 .

The documentation specifies that TemporalPlainDate.compare returns 0 if the dates are the same, irrespective of the calendar.

@ptomato ptomato added the documentation Additions to documentation label Nov 16, 2020
@ptomato ptomato added this to the Stage 3 milestone Nov 16, 2020
@ptomato
Copy link
Collaborator

ptomato commented Nov 16, 2020

This should be fixed in the documentation. Comparing calendars in compare() is a requirement for sort order to be stable; see discussion in #588.

@ptomato ptomato self-assigned this Jan 13, 2021
ptomato added a commit that referenced this issue Jan 13, 2021
The documentation was not clear on this, and in the case of equals() was
actually wrong. A true result from equals() implies a zero result from
compare().

Closes: #1199
Ms2ger pushed a commit that referenced this issue Jan 13, 2021
The documentation was not clear on this, and in the case of equals() was
actually wrong. A true result from equals() implies a zero result from
compare().

Closes: #1199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants