Files
30-seconds-of-code/snippets/get-days-difference-between-dates.md
2017-12-14 10:36:36 -02:00

283 B

Get Days Difference Between Dates

Returns the number of days between two Dates.

const getDaysDiffBetweenDates = (dateInitial, dateFinal) => (dateFinal - dateInitial) / (1000 * 3600 * 24);
//getDaysDiffBetweenDates(new Date("2017-12-13"), new Date("2017-12-22")) -> 9