From 9dd444e6682a076647315e22504eacc6979f84aa Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 2 Mar 2016 16:14:36 -0500 Subject: [PATCH] (js) Fix date parsing for timezone after UTC+0 Fixes #3481, #3494 --- NEWS | 1 + UI/WebServerResources/js/Common/utils.js | 26 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 3a65017186..aef349e430 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,7 @@ Bug fixes - [web] removed double-quotes from Chinese (Taiwan) translations that were breaking templates - [web] fixed unseen count retrieval of nested IMAP folders - [web] properly extract the mail column values from an SQL contacts source (#3544) + - [web] fixed incorrect date formatting when timezone was after UTC+0 (#3481, #3494) - [eas] allow EAS attachments get on 2nd-level mailboxes (#3505) - [eas] fix EAS bday shift (#3518) diff --git a/UI/WebServerResources/js/Common/utils.js b/UI/WebServerResources/js/Common/utils.js index c355c5791e..b76c105af1 100644 --- a/UI/WebServerResources/js/Common/utils.js +++ b/UI/WebServerResources/js/Common/utils.js @@ -357,19 +357,19 @@ Date.prototype.format = function(localeProvider, format) { date = [], validParts = /%[daAmbByYHIMp]/g, val = { - '%d': this.getUTCDate(), // day of month (e.g., 01) - '%e': this.getUTCDate(), // day of month, space padded - '%a': localeProvider.shortDays[this.getUTCDay()], // locale's abbreviated weekday name (e.g., Sun) - '%A': localeProvider.days[this.getUTCDay()], // locale's full weekday name (e.g., Sunday) - '%m': this.getUTCMonth() + 1, // month (01..12) - '%b': localeProvider.shortMonths[this.getUTCMonth()], // locale's abbreviated month name (e.g., Jan) - '%B': localeProvider.months[this.getUTCMonth()], // locale's full month name (e.g., January) - '%y': this.getUTCFullYear().toString().substring(2), // last two digits of year (00..99) - '%Y': this.getUTCFullYear(), // year - '%H': this.getHours(), // hour (00..23) - '%M': this.getMinutes() }; // minute (00..59) - val['%I'] = val['%H'] > 12 ? val['%H'] % 12 : val['%H']; // hour (01..12) - val['%p'] = val['%H'] < 12 ? l('AM') : l('PM'); // locale's equivalent of either AM or PM + '%d': this.getDate(), // day of month (e.g., 01) + '%e': this.getDate(), // day of month, space padded + '%a': localeProvider.shortDays[this.getDay()], // locale's abbreviated weekday name (e.g., Sun) + '%A': localeProvider.days[this.getDay()], // locale's full weekday name (e.g., Sunday) + '%m': this.getMonth() + 1, // month (01..12) + '%b': localeProvider.shortMonths[this.getMonth()], // locale's abbreviated month name (e.g., Jan) + '%B': localeProvider.months[this.getMonth()], // locale's full month name (e.g., January) + '%y': this.getFullYear().toString().substring(2), // last two digits of year (00..99) + '%Y': this.getFullYear(), // year + '%H': this.getHours(), // hour (00..23) + '%M': this.getMinutes() }; // minute (00..59) + val['%I'] = val['%H'] > 12 ? val['%H'] % 12 : val['%H']; // hour (01..12) + val['%p'] = val['%H'] < 12 ? l('AM') : l('PM'); // locale's equivalent of either AM or PM val['%d'] = (val['%d'] < 10 ? '0' : '') + val['%d']; val['%e'] = (val['%e'] < 10 ? ' ' : '') + val['%e'];