Skip to content

Commit fc47e24

Browse files
fix(dateFilter): ignore era format specifier "G"
The era format specifier is not supported in our locale code and is being passed through as the letter G in some long date formats, such as Thai (th-th). It is not straightforward to provide locale specific era formatting since the logic is calendar (locale) specific and not provided by the Google closure library. This commit simply ignores the G in format strings until we can work out a better strategy for dealing with eras. Closes angular#10503
1 parent a3c3bf3 commit fc47e24

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ng/filter/filters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ var DATE_FORMATS = {
321321
w: weekGetter(1)
322322
};
323323

324-
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/,
324+
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/,
325325
NUMBER_STRING = /^\-?\d+$/;
326326

327327
/**

test/ng/filter/filtersSpec.js

+4
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ describe('filters', function() {
293293

294294
expect(date(earlyDate, "MMMM dd, y")).
295295
toEqual('September 03, 1');
296+
297+
expect(date(earlyDate, "MMMM dd, G y")).
298+
toEqual('September 03, 1');
299+
296300
});
297301

298302
it('should accept negative numbers as strings', function() {

0 commit comments

Comments
 (0)