-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
It would be really handy to be able to get the totalSeconds, totalMinutes, etc. from a duration.
const { totalSeconds } = parse(duration)I have a use case for this where we're normalizing the length of different media to seconds and one of the formats is an ISO duration. Currently I have to parse the duration, then convert all the components to seconds then add them up.
const durationToSeconds = (duration: string): number => {
const parsed = parse(duration)
const totalSeconds =
(parsed.hours ?? 0) * 3600 +
(parsed.minutes ?? 0) * 60 +
(parsed.seconds ?? 0)
return totalSeconds ?? 0
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed