I have a fillible PDF with fields that include a start date(mm-dd-yyyy) and start time(HHMM) with corresponding end date and end time. The goal is to have the TOTAL time elapsed between the start date/time and end date/time, formated as HH:MM. This total needs to have the capacity to exceed 24 hours, as in if the start date/time is 10/01/2024 at 1000 and the end date/time is 10/02/2024 at 1100, the result can be 25. I am having no luck finding info around the web on how to allow for a total OVER 24 hours, maybe I am not using the correct search string. I have run across multiple posts with working javascripts and the one I have currently correctly calculates total time as long as it does not occur between two dates/times that result in a total larger than 24. Using the above example will result in a total time of 1:00.

The script I am using is as follows:
var timefinished = this.getField("outage_end_time").valueAsString;
var timestarted = this.getField("outage_start_time").valueAsString;
var datefinished = this.getField("outage_end_date").valueAsString;
var datestarted = this.getField("outage_start_date").valueAsString;
if (datefinished && datestarted && timefinished && timestarted) {
var datetimefinished = util.scand("mm-dd-yyyy HH:MM", datefinished + " " + timefinished);
var datetimestarted = util.scand("mm-dd-yyyy HH:MM", datestarted + " " + timestarted);
var difflnMilliSeconds = Math.abs(datetimefinished - datetimestarted)/1000;
// calculate hours
var hours = Math.floor(difflnMilliSeconds / 3600) % 24;
difflnMilliSeconds -= hours *3600;
// calculate minutes
var minutes = Math.floor(difflnMilliSeconds / 60) % 60;
difflnMilliSeconds -= minutes * 60;
// set field value to the difference
event.value = hours + ":" + minutes;
} else event.value = "";
The addition of milliseconds is not important, but the resulting total so far is acceptable, outside of not being reported as MORE than 24. My question is this: can the total time result in a true hour calculation, or am I asking for the moon? Do I need to either add a string to the code, or is the calculation not appropriate for the use. I am certainly not well versed with javascript, any help/advice/suggestions would be greatly appreciated.