Created
October 16, 2019 23:42
-
-
Save callmephil/3238026fe4406d95156cc7adcd60b1d2 to your computer and use it in GitHub Desktop.
dasd
This file contains hidden or 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
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