Getting the hours and minutes of time variable in js


I have field of type time, I need to get the hours and minutes of the field. How?
For example, the field name is: duration and its value was: 01:10:00 (it is 1 hour and 10 minute), how can I get the hour value and minute value in js?

I tried to use frm.doc.duration.getHours() but did not work.


Hi @bghayad
you can easily use the momentjs methods as it is already included in frappe

var yourtime =  moment(cur_frm.doc.duration, "HH:mm:ss A");
var hour = yourtime.hour();
var minute = yourtime.minute();

hope that helps