I want to format hours minutes seconds
when I get the diff
value from dayjs
.
This is my code:
newAppoint.occupied.push({
hours: dayjs().diff(user.appointment, 'hour'),
minutes: dayjs().diff(user.appointment, 'minute'),
seconds: dayjs().diff(user.appointment, 'second')
});
Now the problem is that I get difference like 0 hrs 3 min 228 sec
.
How can I turn that into something like this: 00 hrs 03 min 59 sec
?
I've tried to add this code after the push
function:
dayjs(newAppoint.occupied.hours).format('hh');
dayjs(newAppoint.occupied.minutes).format('mm');
dayjs(newAppoint.occupied.seconds).format('ss');
But it doesnt make any difference.