From ae0e095995048d717e9b1d4515b36c8f861ec5eb Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 7 Jul 2017 12:57:43 +0200 Subject: [locationinfo] Try working around messy time handling (timezones etc), CSS Webkit/Presto and Blink/Gecko (or rather the corresponding JS engine) disagree about how to handle certain date format strings wrt. time zones. This leads to nasty discrepancies of events being displayed in the calendar. (Unfortunately the students working on this project could not be convinced that properly handling time zones when dealing with time information should be considered important.) Also, some tweaks to CSS/layout have been implemented so the design isn't as messed up on old webkits that don't support flex layout. --- .../jquery-week-calendar/jquery.weekcalendar.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'modules-available/locationinfo/frontend/jquery-week-calendar/jquery.weekcalendar.js') diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/jquery.weekcalendar.js b/modules-available/locationinfo/frontend/jquery-week-calendar/jquery.weekcalendar.js index 63ea1ecd..e84b9057 100755 --- a/modules-available/locationinfo/frontend/jquery-week-calendar/jquery.weekcalendar.js +++ b/modules-available/locationinfo/frontend/jquery-week-calendar/jquery.weekcalendar.js @@ -43,7 +43,7 @@ function MyDate() { return { options: { - date: MyDate(), + date: MyDate, timeFormat: null, dateFormat: 'M d, Y', alwaysDisplayTimeMinutes: true, @@ -1441,6 +1441,7 @@ function MyDate() { $.each(eventsToRender, function(i, calEvent) { // render a multi day event as various event : // thanks to http://github.com/fbeauchamp/jquery-week-calendar + if (!calEvent || !calEvent.start || !calEvent.end) return; var initialStart = new Date(calEvent.start); var initialEnd = new Date(calEvent.end); var maxHour = self.options.businessHours.limitDisplay ? self.options.businessHours.end : 24; @@ -2023,9 +2024,6 @@ function MyDate() { * Clean specific event */ _cleanEvent: function(event) { - if (event.date) { - event.start = event.date; - } event.start = this._cleanDate(event.start); event.end = this._cleanDate(event.end); if (!event.end) { @@ -2205,10 +2203,13 @@ function MyDate() { } // this is a human readable date - return Date.parse(d) || new Date(d); + if (d[d.length - 1] !== 'Z') d += 'Z'; + var o = new Date(d); + o.setTime(o.getTime() + (o.getTimezoneOffset() * 60 * 1000)); + return o; } - if (typeof d == 'number') { + if (typeof d === 'number') { return new Date(d); } @@ -2223,12 +2224,12 @@ function MyDate() { var returnStr = ''; for (var i = 0; i < format.length; i++) { var curChar = format.charAt(i); - if (i != 0 && format.charAt(i - 1) == '\\') { + if (i !== 0 && format.charAt(i - 1) === '\\') { returnStr += curChar; } else if (this._replaceChars[curChar]) { returnStr += this._replaceChars[curChar](date, this); - } else if (curChar != '\\') { + } else if (curChar !== '\\') { returnStr += curChar; } } -- cgit v1.2.3-55-g7522