Skip to content

Instantly share code, notes, and snippets.

@adamkal
Created December 31, 2014 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamkal/1c992b92fe6590076116 to your computer and use it in GitHub Desktop.
Save adamkal/1c992b92fe6590076116 to your computer and use it in GitHub Desktop.
Date comparison in JavaScript o_0
var d1 = new Date(0),
d2 = new Date(0),
d3 = new Date(5);
d1 < d3
// true
d3 < d2
// false
d3 == d2
// false
d2 == d1
// false -- o_0
+d2 === +d1
// true
+d3 == +d1
// false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment