You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to discard portion of the duration while formatting ?
To explain better:
All the duration information is presented via API always in seconds.
var dayjs = require("dayjs");
var duration = require("dayjs/plugin/duration");
dayjs.extend(duration)
let durOne = '183';
let durTwo = '8';
console.log(dayjs.duration(durOne, 'seconds').format('m [Min] s [secs]'));
// "3 Min 3 secs"
console.log(dayjs.duration(durTwo, 'seconds').format('m [Min] s [secs]'));
// "0 Min 8 secs"
How can i format it in a way that it would discard m [Min] in second instance?
To elaborate, I want to dynamically show proper duration, regardless of what API sends.
I know i can break it down to objects and threat each and every one of it separately and then combine but was wondering if there's a built in method like we have for escaping characters.
Something like .format('?(m [Min]) s [secs]') where question mark would serve as a checker.
Thanks in advance and sorry if it's a silly question, but it's an only way to learn :D
The text was updated successfully, but these errors were encountered:
Is there a way to discard portion of the duration while formatting ?
To explain better:
All the duration information is presented via API always in seconds.
How can i format it in a way that it would discard
m [Min]
in second instance?To elaborate, I want to dynamically show proper duration, regardless of what API sends.
I know i can break it down to objects and threat each and every one of it separately and then combine but was wondering if there's a built in method like we have for escaping characters.
Something like
.format('?(m [Min]) s [secs]')
where question mark would serve as a checker.Thanks in advance and sorry if it's a silly question, but it's an only way to learn :D
The text was updated successfully, but these errors were encountered: