Support Article
IsBusinessDay returns incorrect value for different timezones
SA-32790
Summary
When a user's timezone is different from the calendar's timezone, the Pega function 'isBusinessDay' returns the incorrect value. Example: The user's timezone is Australia/Adelaide. The calendar instance is defined in the America/New_York timezone. A date of 1/17/2017 is selected (which is not a business holiday but 1/16/2017 is). In this case, the isBusinessDay fn returns false as its response.
Error Messages
Not Applicable
Steps to Reproduce
- Set the user's timezone to Australia/Adelaide.
- Create a Calendar instance with the America/New_York timezone. On the calendar instance, mark 1/16/2017 as a closed day.
- Have a date input and select 1/17/2017 as the date.
- Execute the onchange action on the date input to trigger a function to check if the input date is a business holiday.
- Observe the system returns false as the output of the isBusinessDay function.
Root Cause
When time-value is omitted, it is defaulted, and the defaulted value may fall on a different day in a different time zone.
Resolution
Pass a date-time to the isBusinessDay function, not just a date.
Published January 24, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.