I have a starting time and I need to add an ending time to it. For example:
start=19:09
end=00:51 // 0 hours and 51 minutes
I want to add the 51 minutes to the 19:09 to make it 20:00.
I've attempted several different methods as shown below, but none are producing the correct time.
I tried:
let [hour, minute] = end.split(':').map(Number);
this.end = Moment(start).add({ hour: 'hours', minute: 'minutes' }) // also tried .add(hour,'hours').add(minute,'minutes')
which still results in 19:09. It seems to be disregarding my end time.
I also tried:
Moment(end, 'hh:mm').add(Moment.duration(start)).format("hh:mm");
which gives me an output of 08:00 when it should be 20:00
What am I missing? I want to add the end time to a start time. Keep in mind that the end time is always changing, sometimes being 13:05, etc. because it's based on user input.