Skip to content

Instantly share code, notes, and snippets.

@Erichain
Created March 11, 2016 09:51
Show Gist options
  • Save Erichain/d5871651cea362766d69 to your computer and use it in GitHub Desktop.
Save Erichain/d5871651cea362766d69 to your computer and use it in GitHub Desktop.
A function to calculate the difference between days
function calcDaysDiff( start, end ) {
var currentDate = start || new Date(),
timeDiff = end - currentDate,
timeUnit = 24 * 60 * 60 * 1000,
diff = 0;
diff = (timeDiff - currentDate % timeUnit) / timeUnit + 1;
return Math.floor(diff);
}
@ZackGabri
Copy link

oh ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment