'calculate difference in HH:mm between two different time in same date with javascript
I have two date fields with different time - INIT1 and END1. I need to populate a third field TTL1 with the difference in hours and minutes between these two date fields.
Then I have two other date fields with different time - INIT2 and END2 and I have to do the same thing with these. In the end I have to add the two differences, one of which could be zero, to get the total time in hours and minutes. I've tried several solutions with the examples found here, but they don't fulfill my need.
I am a newbie, be understanding, please...Thank you
Solution 1:[1]
Do you already know the library "date-fns"? I think it can be useful for this case. I'm almost sure that this link can be the solution for your question.
https://date-fns.org/v2.28.0/docs/differenceInMinutes
(also, they have options for difference in seconds, hours, days and etc).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Erika Irina |
