Skip to content

Instantly share code, notes, and snippets.

@jorge8168711
Last active April 13, 2020 18:01
Show Gist options
  • Save jorge8168711/9f05006b63933e9430cb555d302e3286 to your computer and use it in GitHub Desktop.
Save jorge8168711/9f05006b63933e9430cb555d302e3286 to your computer and use it in GitHub Desktop.
Function for get amount of days between two dates
/**
*
* @param {Date} startDate
* @param {Date} endDate
* @returns {number}
*/
function getAmountOfDays(startDate, endDate) {
return Math.round((endDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24) + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment