Support Article
@addTime function calculates incorrect time with calendar
SA-5692
Summary
@addTime function is used to calculate expiry time, based on that time, a button will be enabled which will release the ratings on the website.
The addTime function does not calculate correct time, when calendar instance is passed as parameter. It calculates correct time when calendar instance is not passed.
Using Calendar instance, it sometime gives the results with a difference of 2 or 3 days, sometime it takes up 8 Normal Hours, instead of Business Hours.
Error Messages
NA
Steps to Reproduce
1.) Create an activity and use addtime function with the following syntax:
@addTime(param.Starttime, 0, Local.BusinessHours, 0, 0, true, Param.CalendarInstance)
where Param.Starttime will be current time, Local.BusinessHours = 8 and CalendarInstance can be any.
2. Use the same without calendar
@addTime(param.Starttime, 0, Local.Normal, 0, 0, false, "")
Root Cause
The root cause of this problem is due to the calendar instance not using the time zone field while acquiring Gregorian Calendar in the class CalendarUtility.java.
Resolution
Hfix-20720 helps address this issue - the amendment done is to include time zone while acquiring the calendar instance s below:
GregorianCalendarFactory.acquire(tmz);
Published January 31, 2016 - 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.