If you try this:

(new Date(2000, 0, 1)) == (new Date(2000, 0, 1))

you may be surprised to learn that it is actually false, because they are different object references, even if the values are the same. If you want to check equality of two dates, you need to compare the values instead of the Date objects:

(new Date(2000, 0, 1)).valueOf() == (new Date(2000, 0, 1).valueOf())

相关文章:

  • 2021-12-30
  • 2021-07-29
  • 2022-12-23
  • 2021-07-22
  • 2021-06-08
  • 2022-12-23
  • 2021-04-12
  • 2021-05-12
猜你喜欢
  • 2021-08-30
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-07-01
  • 2022-01-06
  • 2022-01-10
相关资源
相似解决方案