clarification on Glideschedule API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 12:23 AM
Hi All,
I want to add business days using the GlideSchedule API. Here is the code:
var startDate = new GlideDateTime(current.sys_created_on);
var days = 5;
var schedule = new GlideSchedule("08fcd0830a0a0b2600079f56b1adb9ae"); // 8-5 weekdays excluding holidays
var duration = new GlideDuration(1000 * 60 * 60 * 9 * days);
var end = schedule.add(startDate, duration);
The code is working fine, but the issue is that if the start Date is on December 20, it adds 5 days and ignores December 25, which is a holiday. If I select December 19, it adds 5 days and ignores December 24, resulting in December 25, which is incorrect since it is also a holiday.
How can I ensure that both holidays are ignored, so that the calculation correctly considers all holidays?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 05:42 PM
hi @kummara _siva ,
> var schedule = new GlideSchedule("08fcd0830a0a0b2600079f56b1adb9ae"); // 8-5 weekdays excluding holidays
Is this sys_id ("08fcd0830a0a0b2600079f56b1adb9ae") correct?
It seems that this sys_id is for "8-5 weekdays", and sys_id : "090eecae0a0a0b260077e1dfa71da828" is for "8-5 weekdays excluding holidays".
Could you check this point in your end?