User-893317190 posted
Hi micnie2020 ,
Not clear about your requirement, what result do you want to get?
From your function , you get the minute difference between startTime and endTime and set new moment's minute to the calculated minutes.
Finally return the HH:mm format of the moment.
What do you want to get from this function?
If you want to use js , you could refer to the code below.
var date = new Date("0000-01-01 09:00"); // initialize a Date and set its time to 09:00
date.setHours(date.getHours() + 5, date.getMinutes() + 30); //date.getHours() + 5 adds 5 hours to current hour and set date's hour to the new hour, minutes is the same
console.log(date.getHours() + ":" + date.getMinutes()); // show the new hour and minutes
The result.

Best regards,
Ackerly Xu