I tried comparing 2 same dates in the chrome console:
new Date("2021-06-23") == new Date("2021-06-23")
It is giving false
new Date("2021-06-23") > new Date("2021-06-23")
It is giving false
But, new Date("2021-06-23") >= new Date("2021-06-23")
It is giving true
I couldn't understand why it is giving true for greater than or equal to but false for both greater than also and for equals to as well.
Please explain.
==when applied to objects checks if they are the same object, not if two different objects but with similar content. Relationship operators instead do implicit conversion.Dateobjects have defined behaviour for>/>=/</<=operators that compares the date value.new Date("2021-06-23") == new Date("2021-06-23")would be true anyway, as the millisecond may change between calls.