Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
isInSchedule() evaluates one second off when user profile and schedule timezones do not match - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • isInSchedule() evaluates one second off when user profile and schedule timezones do not match
KB0634382

isInSchedule() evaluates one second off when user profile and schedule timezones do not match


2046 Views Last updated : Feb 17, 2023 public Copy Permalink
KB Summary by Now Assist

Description

 

The isInSchedule API can evaluate differently depending on the configuration of the schedule and the current user-session.

The different behavior occurs only when checking if the end time is in the schedule, where the time is on the hour, such as 19:00:00.

This behavior is noticed when the session's time zone matches the time zone of the schedule. 

 

Steps to Reproduce

Create a schedule defined in the US/Eastern time zone, with a single span that starts at 17:00:00 and ends at 19:00:00 repeating daily.

The script below is the test case that can be executed in Background Scripts:


    // Provide UTC value of 19:00:00 US/Eastern
    var endTime = new GlideDateTime("2017-06-21 23:00:00");

    // Provide the sys_id of the US/Eastern schedule
    var schedule = new GlideSchedule("SYS_ID_SCHEDULE");

    gs.print( schedule.isInSchedule(endTime) );
 

If current user-session time zone is US/Eastern the above script prints true.

If current user-session time zone is not US/Eastern the above script prints false.

Workaround

For an end time on the hour to be excluded, the schedule entries end date time must be *:59:59. For example, 18:59:59 instead of 19:00:00.

The isInSchedule API returns true when checking if 18:59:59 is in the schedule but false when checking if 19:00:00 is in the schedule.


Related Problem: PRB1057795

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.