-
-
Save nithesh1992/9649adc5f3039bd176ca44441d776553 to your computer and use it in GitHub Desktop.
Find the number of days between two dataes
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 dayDif = (date1, date2) => Math.ceil(Math.abs(date1.getTime() - date2.getTime()) / 86400000) | |
dayDif(new Date("2020-10-21"), new Date("2021-10-22")) | |
// Result: 366 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment