Last active
May 31, 2016 12:56
-
-
Save karlpokus/c1771066f83d15c4ca07 to your computer and use it in GitHub Desktop.
Number of days between two dates
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 dayDiff(f, s, abs){ | |
var f = new Date(f), | |
s = new Date(s), | |
oneDay = 24*60*60*1000; | |
if (abs) { | |
return Math.round(Math.abs((f.getTime() - s.getTime())/(oneDay))); | |
} else { | |
return Math.round((f.getTime() - s.getTime())/(oneDay)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment