I have the following input formats of the time
const formats = ['m:ss', 'mm:ss', 'H:mm:ss', 'HH:mm:ss'];
and I need to extract the number of seconds using moment.js.
I tried this:
const myMoment = moment('03:30', formats);
const totalSeconds = myMoment.asSeconds();
and this
const formats = ['m:ss', 'mm:ss', 'H:mm:ss', 'HH:mm:ss'];
const duration = moment.duration('03:50', formats);
const totalSeconds = duration.asSeconds();
but neither works