longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
- L : 'DD/MM/YYYY',
+ L : 'D/\u200FM/\u200FYYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY LT',
LLLL : 'dddd D MMMM YYYY LT'
yy : pluralize('y')
},
preparse: function (string) {
- return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
+ return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
return numberMap[match];
}).replace(/،/g, ',');
},
['[the] DDDo [day of the year]', 'the ٤٥ day of the year'],
['LT', '١٥:٢٥'],
['LTS', '١٥:٢٥:٥٠'],
- ['L', '١٤/٠٢/٢٠١٠'],
+ ['L', '١٤/\u200f٢/\u200f٢٠١٠'],
['LL', '١٤ شباط فبراير ٢٠١٠'],
['LLL', '١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'],
['LLLL', 'الأحد ١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'],
- ['l', '١٤/٢/٢٠١٠'],
+ ['l', '١٤/\u200f٢/\u200f٢٠١٠'],
['ll', '١٤ شباط فبراير ٢٠١٠'],
['lll', '١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'],
['llll', 'أحد ١٤ شباط فبراير ٢٠١٠ ١٥:٢٥']
assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i);
}
});
+
+test('no leading zeros in long date formats', function (assert) {
+ var i, j, longDateStr, shortDateStr;
+ for (i = 1; i <= 9; ++i) {
+ for (j = 1; j <= 9; ++j) {
+ longDateStr = moment([2014, i, j]).format('L');
+ shortDateStr = moment([2014, i, j]).format('l');
+ assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day');
+ }
+ }
+});