diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js index b03e2ef03c..be49999535 100644 --- a/calendar/js/et2_widget_planner.js +++ b/calendar/js/et2_widget_planner.js @@ -832,8 +832,6 @@ var et2_calendar_planner = /** @class */ (function (_super) { this.now_div.hide(); return false; } - // Planner uses the dates, not just the times so need things right - now = new Date(now.valueOf() - now.getTimezoneOffset() * 60000); var row = null; for (var i = 0; i < this._children.length && row == null; i++) { if (this._children[i].instanceOf(et2_widget_planner_row_1.et2_calendar_planner_row)) { diff --git a/calendar/js/et2_widget_planner.ts b/calendar/js/et2_widget_planner.ts index 49a74c238c..ab041f5df6 100644 --- a/calendar/js/et2_widget_planner.ts +++ b/calendar/js/et2_widget_planner.ts @@ -1071,8 +1071,6 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta return false; } - // Planner uses the dates, not just the times so need things right - now = new Date(now.valueOf() - now.getTimezoneOffset()*60000); let row = null; for(let i = 0; i < this._children.length && row == null; i++) { diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index e0f4557f78..e070db5967 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -521,7 +521,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) { if (day.getDate() >= now) { day = this.day_widgets[i - 1]; this.now_div.appendTo(day.getDOMNode()).show(); - var pos = day._time_to_position(now.getHours() * 60 + now.getMinutes()); + var pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes()); //this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()}); this.now_div.css('top', pos + '%'); break; diff --git a/calendar/js/et2_widget_timegrid.ts b/calendar/js/et2_widget_timegrid.ts index 5a8b588ac0..04674005c5 100644 --- a/calendar/js/et2_widget_timegrid.ts +++ b/calendar/js/et2_widget_timegrid.ts @@ -714,7 +714,7 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet { day = this.day_widgets[i-1]; this.now_div.appendTo(day.getDOMNode()).show(); - let pos = day._time_to_position(now.getHours() * 60 + now.getMinutes()); + let pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes()); //this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()}); this.now_div.css('top', pos + '%'); break; diff --git a/calendar/js/et2_widget_view.js b/calendar/js/et2_widget_view.js index 8b3d32f0f5..1e8c97ac1e 100644 --- a/calendar/js/et2_widget_view.js +++ b/calendar/js/et2_widget_view.js @@ -293,9 +293,10 @@ var et2_calendar_view = /** @class */ (function (_super) { * @private */ et2_calendar_view.prototype._updateNow = function () { - var now = new Date(); + var tempDate = new Date(); + var now = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), tempDate.getMinutes() - tempDate.getTimezoneOffset(), 0); // Use date widget's existing functions to deal - this._date_helper.set_value(now); + this._date_helper.set_value(now.toJSON()); now = new Date(this._date_helper.getValue()); if (this.get_start_date() <= now && this.get_end_date() >= now) { return now; diff --git a/calendar/js/et2_widget_view.ts b/calendar/js/et2_widget_view.ts index 9162d71fab..b43b9ff1f2 100644 --- a/calendar/js/et2_widget_view.ts +++ b/calendar/js/et2_widget_view.ts @@ -365,9 +365,11 @@ export class et2_calendar_view extends et2_valueWidget */ public _updateNow() { - let now = new Date(); + var tempDate = new Date(); + var now = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),tempDate.getHours(),tempDate.getMinutes()-tempDate.getTimezoneOffset(),0); + // Use date widget's existing functions to deal - this._date_helper.set_value(now); + this._date_helper.set_value(now.toJSON()); now = new Date(this._date_helper.getValue()); if(this.get_start_date() <= now && this.get_end_date() >= now)