Skip to content

Instantly share code, notes, and snippets.

@johnbocook
Created July 17, 2017 12:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbocook/e9f44a9d324da5e918c720b9575494af to your computer and use it in GitHub Desktop.
Save johnbocook/e9f44a9d324da5e918c720b9575494af to your computer and use it in GitHub Desktop.
Javascript Date Compare
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