Skip to content

Instantly share code, notes, and snippets.

@callmephil
Created October 16, 2019 23:42
Show Gist options
  • Save callmephil/3238026fe4406d95156cc7adcd60b1d2 to your computer and use it in GitHub Desktop.
Save callmephil/3238026fe4406d95156cc7adcd60b1d2 to your computer and use it in GitHub Desktop.
dasd
const getDaysDiff = (start_date, end_date, date_format = 'YYYY-MM-DD') => {
const getDateAsArray = (date) => {
return moment(date.split(/\D+/), date_format);
}
return getDateAsArray(end_date).diff(getDateAsArray(start_date), 'days') + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment