Support Article
Calendar displays duplicate dates for Brazil timezone
SA-19275
Summary
Dates are showing twice in calendar for UTC-03:00 Brasilia timezone.
Error Messages
Not Applicable.
Steps to Reproduce
1. Change system time to "UTC-03:00 Brasilia" and set operator timezone to Brazil or Acre.
2. Add DateTime control in section and add the section in flow.
3. Run the case and go to October month.
4. Observe that date 17 is displayed twice.
Root Cause
A defect or configuration issue in the operating environment :-
There is a bug with IE.tomorrow = tomorrow.setDate(today.getDate()+1) for october month especially 17th date even after incrementing with 1 day it is internally incrementing just 23hrs instead of 24hrs and local change [IE.tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000)); ] to fix the above issue,shows 20th feb twice in calendar.
Resolution
Perform the following local-change:
Add below script in userworkform to fix the issue:
<script>
var calFix = function(){
if(pega && pega.u && pega.u.d && pega.u.d.CalendarUtil) {
pega.u.d.CalendarUtil.add = function (date, field, amount) {
var d = new Date(date.getTime());
switch (field) {
case this.MONTH:
var newMonth = date.getMonth() + amount;
var years = 0;
var newDay = date.getDate();
if (newMonth < 0) {
while (newMonth < 0) {
newMonth += 12;
years -= 1;
}
}
else if (newMonth > 11) {
while (newMonth > 11) {
newMonth -= 12;
years += 1;
}
}
d.setMonth(newMonth);
d.setFullYear(date.getFullYear() + years);
break;
case this.DAY:
if(amount != 1){
d.setDate(date.getDate() + amount);
}else{
//d = new Date(date.getTime() + (24 * 60 * 60 * 1000));
d.setDate(date.getDate() + amount);
d.setHours(d.getHours() > 12 ? d.getHours() + 2 : 0); // daylight saving check
}
break;
case this.YEAR:
d.setFullYear(date.getFullYear() + amount);
break;
case this.WEEK:
d.setDate(date.getDate() + 7);
break;
}
return d;
};
}
};
setTimeout(calFix, 500);
</script>
Published February 9, 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.