Created
October 2, 2021 21:52
-
-
Save sayyedhammadali/6fd5c01e82207547978e9296a76f3b00 to your computer and use it in GitHub Desktop.
Find the number of days between two dataes
This file contains 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