@@ -352,8 +352,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d
352
352
* * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)
353
353
* * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)
354
354
*
355
- * `format` string can contain literal values. These need to be quoted with single quotes (e.g.
356
- * `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence
355
+ * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
356
+ * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
357
357
* (e.g. `"h 'o''clock'"`).
358
358
*
359
359
* @param {(Date|number|string) } date Date to format either as Date object, milliseconds (string or
@@ -373,6 +373,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d
373
373
<span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
374
374
<span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma' }}</span>:
375
375
<span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma' }}</span><br>
376
+ <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
377
+ <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
376
378
</file>
377
379
<file name="protractor.js" type="protractor">
378
380
it('should format date', function() {
@@ -382,6 +384,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d
382
384
toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
383
385
expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
384
386
toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
387
+ expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
388
+ toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
385
389
});
386
390
</file>
387
391
</example>
0 commit comments