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

Date comparison #163

Open
Glandos opened this issue Apr 30, 2021 · 2 comments · May be fixed by #166
Open

Date comparison #163

Glandos opened this issue Apr 30, 2021 · 2 comments · May be fixed by #166

Comments

@Glandos
Copy link

Glandos commented Apr 30, 2021

I'm surprised no one uncovered that here:

new Date(10) == new Date(10) // false
new Date(10) < new Date(11) // true
new Date(11) > new Date(12) // false
new Date(11) > new Date(10) // true

Two object instances are always unequal. But they decided to overload operator < and > for Date and not ==. This renders the whole thing useless.

@shaedrich
Copy link
Contributor

Feel free to go ahead and create a document at src/shared/md and a respective PR

@Glandos Glandos linked a pull request Apr 12, 2023 that will close this issue
@azder
Copy link

azder commented Sep 23, 2023

  const a = new Date(10);
  const b = new Date(10);
  const areEqual = (false === a < b && false === b < a)

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.

3 participants