Skip to content

Instantly share code, notes, and snippets.

@johnmurch
Created February 15, 2017 17:37
Show Gist options
  • Save johnmurch/1be9abd4ec56b8628bbacd8e9a7aad9c to your computer and use it in GitHub Desktop.
Save johnmurch/1be9abd4ec56b8628bbacd8e9a7aad9c to your computer and use it in GitHub Desktop.
Determine is today within 30 days of a date and/or has past
var today = new Date();
alert(today);
var future_date = new Date('2017/1/20 13:03:35 GMT-0400');
alert(future_date);
var difference = future_date.getTime() - today.getTime();
var thirty_days = 3600 * 24 * 30 * 1000;
alert(difference < thirty_days);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment