Created
March 11, 2016 09:51
-
-
Save Erichain/d5871651cea362766d69 to your computer and use it in GitHub Desktop.
A function to calculate the difference between days
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
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh ty