Created
July 17, 2017 12:21
-
-
Save johnbocook/e9f44a9d324da5e918c720b9575494af to your computer and use it in GitHub Desktop.
Javascript Date Compare
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 myDate = '05/05/2019'; | |
var today = new Date(); | |
function process(date) { | |
var parts = date.split("/"); | |
return new Date(parts[2], parts[1] - 1, parts[0]); | |
} | |
if (process(myDate) <= today) { | |
console.log('Before Today'); | |
} else { | |
console.log('After Today'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment