Event Schedule Not working Properly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:29 PM
I want to check if the given date is falling in the Business days or not, for I created one schedule in the cmn_schedule and I used the below code but it's not working as expected
My expectation it should return true for all the time from 00 to 24
'08/07/2023 00:00:00'-- its returning False
'08/07/2023 5:00:00'--- its returning True
var startDate = new GlideDateTime('08/07/2023 00:00:00');
var grSchedule = "a2fe3d39977d6110318dbf8fe153af80"
var schedule = new GlideSchedule(grSchedule);
var d = new GlideDateTime(startDate);
gs.info(schedule.isInSchedule(d))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:36 PM - edited 08-08-2023 10:36 PM
Hello @ramesh_r
Actually when you select All day inside the schedule it will consider the Time till 23:59:59, May be for 00:00:00 it is not considering, In that case you can mention a Special case in your script.
var startDate = new GlideDateTime('08/07/2023 00:00:00');
var grSchedule = "a2fe3d39977d6110318dbf8fe153af80"
var schedule = new GlideSchedule(grSchedule);
var d = new GlideDateTime(startDate);
var time = d.getTime();
if(time=='00:00:00'){
gs.info(true);
}
else{
gs.info(schedule.isInSchedule(d))
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh