How to count duration between two times?
var start = moment(\'17:00\', \"HH:mm\");
var end = moment(\'02:15\', \"HH:mm\");
moment.duration(end.diff(start)).a
I think the problem is that you have 2 moment objects, one representing today 17:00 and one today 02:15. Though you want today 17:00 and tomorrow 02:15. Just use moment('02:15', "HH:mm").add(1, 'days') to get the next day.
var start = moment('17:00', "HH:mm");
var end = moment('02:15', "HH:mm").add(1, "days");
var result = moment.duration(end.diff(start)).asHours();
document.write(result);