Skip to content

Commit ae7f6db

Browse files
author
Levi Zitting
committed
Switch to Date.setTime() to completely avoid the issue
1 parent 1823a63 commit ae7f6db

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

recurrence/static/recurrence/js/recurrence-widget.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,7 @@ recurrence.widget.Calendar.prototype = {
238238
month != this.date.getMonth() ||
239239
day != this.date.getDate()) {
240240

241-
this.date.setFullYear(year);
242-
this.date.setMonth(month);
243-
this.date.setDate(day);
244-
this.date.setMonth(month);
241+
this.date.setTime(new Date(year, month, day) / 1);
245242

246243
recurrence.array.foreach(
247244
this.elements.month_grid.cells, function(cell) {
@@ -406,11 +403,8 @@ recurrence.widget.DateSelector.prototype = {
406403

407404
if (!this.date)
408405
this.date = recurrence.widget.date_today();
409-
410-
this.date.setFullYear(year);
411-
this.date.setMonth(month);
412-
this.date.setDate(day);
413-
this.date.setMonth(month);
406+
407+
this.date.setTime(new Date(year, month, day) / 1);
414408

415409
this.elements.date_field.value = datestring;
416410

recurrence/static/recurrence/js/recurrence.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,19 +679,9 @@ recurrence.deserialize = function(text) {
679679
}
680680
var dt = new Date();
681681
if (text.indexOf('Z') > 0) {
682-
dt.setUTCFullYear(year);
683-
dt.setUTCMonth(month - 1);
684-
dt.setUTCDate(day);
685-
dt.setUTCHours(hour);
686-
dt.setUTCMinutes(minute);
687-
dt.setUTCSeconds(second);
682+
dt.setTime(Date.UTC(year, month - 1, day, hour, minute, second) / 1);
688683
} else {
689-
dt.setFullYear(year);
690-
dt.setMonth(month - 1);
691-
dt.setDate(day);
692-
dt.setHours(hour);
693-
dt.setMinutes(minute);
694-
dt.setSeconds(second);
684+
dt.setTime(new Date(year, month - 1, day, hour, minute, second) / 1);
695685
}
696686
return dt;
697687
};

0 commit comments

Comments
 (0)