Created
October 21, 2021 10:38
-
-
Save italosantana/e404e001c78a9fde2e210e083c41ee57 to your computer and use it in GitHub Desktop.
Formating a duration from seconds using date-fns
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
import { intervalToDuration } from 'date-fns' | |
const seconds = 10000 | |
intervalToDuration({ start: 0, end: seconds * 1000 }) | |
// { hours: 2, minutes: 46, seconds: 40 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment