Created
November 20, 2020 16:42
-
-
Save such/4adf95feb90a9d34729bb909d4278474 to your computer and use it in GitHub Desktop.
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
// in the Context provider: | |
const interval = setInterval(() => setNow(new Date()), 1000); | |
// becomes: | |
const interval = setInterval(() => setNow(moment()), 1000); | |
// in the Component: | |
return intervalToDuration({ start: date, end: now }); | |
// becomes: | |
return moment.duration(now.diff(date)).format('HH:mm:ss'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment