Comparing dates in JavaScript
Turns out that we can directly compare two native Date objects in JavaScript using normal comparison operators like =, < or >, since the comparison invokes valueOf() of the object, not toString(). Therefore, there’s no need to call Date.getTime() to compare timestamps.
Kudos to T.J. Crowder for his well-researched post.
Leave a Reply