(js) Add support for %p in date formatting

Fixes #3480
This commit is contained in:
Francis Lachapelle
2016-02-01 20:54:37 -05:00
parent a95fd25e09
commit 6bfc44fb53
4 changed files with 21 additions and 3 deletions
+1
View File
@@ -394,6 +394,7 @@ Date.prototype.format = function(localeProvider, format) {
'%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'];