From ab121e6c153208a9e18174d664645c52826ae9d2 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 31 Mar 2015 15:19:53 -0400 Subject: [PATCH] [fix] Issues with freebusy in attendees editor --- NEWS | 1 + UI/WebServerResources/JavascriptAPIExtensions.js | 9 ++++----- UI/WebServerResources/UIxAttendeesEditor.js | 12 ++++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index e402364d2..b9b1c6661 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Bug fixes - now keep the BodyPreference for future EAS use and default to MIME if none set (#3146) - EAS reply fix when message/rfc822 parts are included in the original mail (#3153) - fix yet an other potential crash during freebusy lookups during timezone changes + - fix display of freebusy information in event attendees editor during timezone changes 2.2.17a (2015-03-15) -------------------- diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js index 190a8e99b..0ee1b6b1e 100644 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ b/UI/WebServerResources/JavascriptAPIExtensions.js @@ -130,7 +130,7 @@ Date.prototype.deltaDays = function(otherDate) { day1 = tmp; } - return Math.floor((day2 - day1) / 86400000); + return Math.round((day2 - day1) / 86400000); } Date.prototype.daysUpTo = function(otherDate) { @@ -152,7 +152,7 @@ Date.prototype.daysUpTo = function(otherDate) { // var day1 = day1Date.getTime(); // var day2 = day2Date.getTime(); - var nbrDays = Math.floor((day2 - day1) / 86400000) + 1; + var nbrDays = Math.round((day2 - day1) / 86400000) + 1; for (var i = 0; i < nbrDays; i++) { var newDate = new Date(); newDate.setTime(day1 + (i * 86400000)); @@ -217,9 +217,8 @@ Date.prototype.stringWithSeparator = function(separator) { }; Date.prototype.addDays = function(nbrDays) { - var milliSeconds = this.getTime(); - milliSeconds += 86400000 * Math.round(nbrDays); - this.setTime(milliSeconds); + var dat = new Date(this.valueOf()); + this.setDate(dat.getDate() + Math.round(nbrDays)); }; Date.prototype.earlierDate = function(otherDate) { diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index 7ca8e2874..be7a854bd 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -391,6 +391,12 @@ function redisplayEventSpans() { etHour++; } + if (isAllDay) { + addDays++; + stHour = stMinute = 0; + etHour = etMinute = 0; + } + if (stHour < displayStartHour) { stHour = displayStartHour; stMinute = 0; @@ -432,8 +438,10 @@ function redisplayEventSpans() { if (currentSpanNbr > 3) { currentSpanNbr = 0; currentCellNbr++; - currentCell = row.cells[currentCellNbr]; - spans = $(currentCell).childNodesWithTag("span"); + if (currentCellNbr < row.cells.length) { + currentCell = row.cells[currentCellNbr]; + spans = $(currentCell).childNodesWithTag("span"); + } } deltaSpans--; }