使用momentjs将小时分钟转换为小数时间的最佳方法是什么
假设我有1:30分钟,我希望转换后有1.5
这是我尝试过的
console.log(travelTime().split(':')[0]); return 1
console.log(travelTime().split(':')[1]); return 30 then / 30
Run Code Online (Sandbox Code Playgroud)
travelTime()=="1:30"
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 05:30 from the frontend and I need to add to the current UTC time. How can I do that using momentjs?
I tried that but didn't work
moment().add('05:30', 'HH:mm')
Run Code Online (Sandbox Code Playgroud)