Last active
February 13, 2022 06:36
-
-
Save toshvelaga/f72aab35158dc1a9264d66f3aa02c7d2 to your computer and use it in GitHub Desktop.
The time in days from when the user registered to today
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 timeFromUserRegistration = (dateUserRegistered) => { | |
| // example of dateUserRegistered = '2021-07-30T05:05:27.000Z' | |
| const userDataRegistered = Date.parse(dateUserRegistered) | |
| const currDate = Date.parse(new Date()) | |
| const dateDiff = currDate - userDataRegistered | |
| console.log(dateDiff) | |
| const days = dateDiff / (60 * 60 * 24 * 1000) | |
| return days | |
| } | |
| export default timeFromUserRegistration; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment