diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js index 7805085fd7d6..fa71f59285af 100644 --- a/src/ng/filter/filters.js +++ b/src/ng/filter/filters.js @@ -509,7 +509,7 @@ function dateFilter($locale) { forEach(parts, function(value) { fn = DATE_FORMATS[value]; text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset) - : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); + : value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); }); return text; diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js index 52ad6fbd6a4d..181da0173c0a 100644 --- a/test/ng/filter/filtersSpec.js +++ b/test/ng/filter/filtersSpec.js @@ -381,6 +381,8 @@ describe('filters', function() { it('should treat a sequence of two single quotes as a literal single quote', function() { expect(date(midnight, "yyyy'de' 'a''dd' 'adZ' h=H:m:saZ")). toEqual("2010de a'dd adZ 12=0:5:8AM-0500"); + expect(date(midnight, "EEE, MMM d, ''yy")). + toEqual("Fri, Sep 3, '10"); }); it('should accept default formats', function() {