Skip to content

Commit

Permalink
(js) Fix date parsing for timezone after UTC+0
Browse files Browse the repository at this point in the history
Fixes #3481, #3494
  • Loading branch information
cgx committed Mar 2, 2016
1 parent 73decf2 commit 9dd444e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)

Expand Down
26 changes: 13 additions & 13 deletions UI/WebServerResources/js/Common/utils.js
Expand Up @@ -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'];
Expand Down

0 comments on commit 9dd444e

Please sign in to comment.