Created
August 11, 2015 21:04
-
-
Save robbdempsey/4e6e60cebbb288900cc7 to your computer and use it in GitHub Desktop.
way to check and compare dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nonDate = 1438387200000 | |
var date2 = '2015-08-12' | |
var date1 = '2015-08-01' | |
var obj = Date.parse(date1) | |
var obj2 = Date.parse(date2) | |
console.log(obj) | |
console.log(obj2) | |
var blah = Date.parse(nonDate) | |
console.log(blah) | |
if (obj < obj2) { | |
console.log('its before ' + date2) | |
} else if (obj === obj2) { | |
console.log('%s === %s', date1, date2) | |
} else { | |
console.log('not sure what to do') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment