plannedTaskAPI.calculateDuration is not working properly when added schedule

Poonam Mahajan
Tera Contributor

Hi All,

 

We are facing issue while calculating difference between 2 dates it is giving additional 2 hrs giving unexpected output.

Below is the code -

 

var firstTaskClosedDt = new GlideDateTime('2024-12-18 10:01:06');
var auftragClosedDt = new GlideDateTime('2024-12-30 14:22:10');

var plannedTaskAPI = new SNC.PlannedTaskAPI();
var resp = plannedTaskAPI.calculateDuration(firstTaskClosedDt, auftragClosedDt,'1b499f9cf78e6d105ef541b84851e048');

var response = new JSON().decode(resp);
var duration = response.duration;
var durationStr = duration.toString();
var finalBET = durationStr;
 
Above script is giving this result 5 06:52:26 instead 5 04:21:00.
 
Note : we have schedule which will run from 8am to 5 pm.Also child schedule is added which contains holiday list.
Dates which we are passing having 3 hoildays in between 24th,25th,26th Dec 2024.
 
Can someone please help on this.
0 REPLIES 0