I am using moment library and from front end I am getting time in HH:mm I need to add hours and minutes to current time using moment.
Suppose I am getting <
EDIT: @VincenzoC above provided what I personally think is the best practice. Check this answer only as an alternative to his.
Just do:
moment().add({
hours: 5,
minutes: 30
});
As suggested in the official documentation: http://momentjs.com/docs/#/manipulating/add/
Either use the object literal as above, or use chaining.
I you can't get rid of that string, just acquire hours and minutes by splitting:
let [hours, minutes] = '05:30'.split(':').map(Number);
console.log(hours);
console.log(minutes);