I am calculating the difference between two dates using moments#diff. As a result I am getting a hh:mm format just like I wanted. Now I want to subtract a "Duration field" from that hh:mm time. The problem I am facing is that a Duration field returns a number (i.e.: 1.456) so I believe I can't use diff again. Is there a simple way to parse number to hh:mm or something like this?
You can see below the code that is working right now without the subtraction.
a = moment(Período Inicial).tz("America/Sao_Paulo");
b = moment(Período Final).tz("America/Sao_Paulo");
t1 = moment(a, "hh:mm");
t2 = moment(b, "hh:mm");
t3 = moment(t2.diff(t1)).format("hh:mm")
// Now I need to subtract @Almoço (which returns a duration such as 1.456) from t3...
Please sign in to leave a comment.