Created
November 15, 2020 13:33
-
-
Save AitorAlejandro/27ae8585847ca23bfb7e02f6b676d8bb to your computer and use it in GitHub Desktop.
How to get the difference (in days) between two dates
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 getDaysDiffBetweenDates = (dateInitial, dateFinal) => | |
| (dateFinal - dateInitial) / (1000 * 3600 * 24); | |
| // Example | |
| getDaysDiffBetweenDates(new Date('2017-12-13'), new Date('2017-12-22')); // 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment