Skip to content

Loading…

bug The calendar may have some issues depending on the timezone it is used #448

Closed
wants to merge 1 commit into from

3 participants

@fbasso
Aria Templates member

To avoid the issue, the new dates are created at noon.

@divdavem divdavem was assigned
@fbasso fbasso fix #448 The calendar may have some issues depending on the timezone …
…it is used

To avoid the issue, the new dates are created at noon.

For instance, the Brazilia timezone change the daylight saving time at midnight.
In javascript, a date created with new Date(year, month, day) when the calendar change will result to the day before,
and the calendar widget will have repetitive days around this time.

Setting the dates at noon will prevent the day change.
2c1b95f
@divdavem divdavem added a commit that closed this pull request
@fbasso fbasso fix #448 The calendar may have some issues depending on the timezone …
…it is used

To avoid the issue, the new dates are created at noon.

For instance, the Brazilia timezone change the daylight saving time at midnight.
In javascript, a date created with new Date(year, month, day) when the calendar change will result to the day before,
and the calendar widget will have repetitive days around this time.

Setting the dates at noon will prevent the day change.
4e030c6
@divdavem divdavem closed this in 4e030c6
@jakub-g
Aria Templates member

Due to this fix, a bug in Calendar arose: #455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2013
  1. @fbasso

    fix #448 The calendar may have some issues depending on the timezone …

    fbasso committed
    …it is used
    
    To avoid the issue, the new dates are created at noon.
    
    For instance, the Brazilia timezone change the daylight saving time at midnight.
    In javascript, a date created with new Date(year, month, day) when the calendar change will result to the day before,
    and the calendar widget will have repetitive days around this time.
    
    Setting the dates at noon will prevent the day change.
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/aria/widgets/calendar/CalendarController.js
View
6 src/aria/widgets/calendar/CalendarController.js
@@ -389,7 +389,7 @@
// endDate
if (settings.displayUnit == "W") {
startDate = dateUtils.getStartOfWeek(startDate, settings.firstDayOfWeek);
- realStartDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1);
+ realStartDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1, 12);
realStartDate = dateUtils.getStartOfWeek(realStartDate, settings.firstDayOfWeek);
endDate = new Date(startDate.getTime());
endDate.setDate(endDate.getDate() + 7 * settings.numberOfUnits - 1);
@@ -397,7 +397,7 @@
realEndDate.setDate(32);
realEndDate.setDate(1);
} else /* if (settings.displayUnit == "M") */{
- startDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1);
+ startDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1, 12);
realStartDate = dateUtils.getStartOfWeek(startDate, settings.firstDayOfWeek);
endDate = new Date(startDate.getTime());
endDate.setMonth(endDate.getMonth() + settings.numberOfUnits);
@@ -574,7 +574,7 @@
},
_createDay : function (jsDate) {
var settings = this._calendarSettings;
- var date = new Date(jsDate.getFullYear(), jsDate.getMonth(), jsDate.getDate()); // copying the date
+ var date = new Date(jsDate.getFullYear(), jsDate.getMonth(), jsDate.getDate(), 12); // copying the date
// object
var day = jsDate.getDay();
var res = {
Something went wrong with that request. Please try again.