1
1
part of angular.formatter_internal;
2
2
3
3
/**
4
- * Formats date to a string based on the requested format.
5
- * See Dart http://api.dartlang.org/docs/releases/latest/intl/DateFormat.html
6
- * for full formating options.
7
- *
8
- * - `medium` : equivalent to `MMM d, y h:mm:ss a` for en_US locale (e.g. Sep 3, 2010 12:05:08 pm)
9
- * - `short` : equivalent to `M/d/yy h:mm a` for en_US locale (e.g. 9/3/10 12:05 pm)
10
- * - `fullDate` : equivalent to `EEEE, MMMM d, y` for en_US locale (e.g. Friday, September 3, 2010)
11
- * - `longDate` : equivalent to `MMMM d, y` for en_US locale (e.g. September 3, 2010)
12
- * - `mediumDate` : equivalent to `MMM d, y` for en_US locale (e.g. Sep 3, 2010)
13
- * - `shortDate` : equivalent to `M/d/yy` for en_US locale (e.g. 9/3/10)
14
- * - `mediumTime` : equivalent to `h:mm:ss a` for en_US locale (e.g. 12:05:08 pm)
15
- * - `shortTime` : equivalent to `h:mm a` for en_US locale (e.g. 12:05 pm)
16
- *
4
+ * Formats a date value to a string based on the requested format.
17
5
*
18
6
* Usage:
19
7
*
20
8
* {{ date_expression | date[:format] }}
21
9
*
10
+ * Here `format` may be specified explicitly, or by using one of the following predefined
11
+ * localizable names:
12
+ *
13
+ * FORMAT NAME AS DEFINED FOR en_US OUTPUT
14
+ * ------------- ---------------------- ---------------------------
15
+ * medium MMM d, y h:mm:ss a Sep 3, 2010 12:05:08 pm
16
+ * short M/d/yy h:mm a 9/3/10 12:05 pm
17
+ * fullDate EEEE, MMMM d, y Friday, September 3, 2010
18
+ * longDate MMMM d, y September 3, 2010
19
+ * mediumDate MMM d, y Sep 3, 2010
20
+ * shortDate M/d/yy 9/3/10
21
+ * mediumTime h:mm:ss a 12:05:08 pm
22
+ * shortTime h:mm a 12:05 pm
23
+ *
24
+ *
25
+ * For more on explicit formatting of dates and date syntax, see the documentation for the
26
+ * [DartFormat class] (http://api.dartlang.org/docs/releases/latest/intl/DateFormat.html).
27
+ *
22
28
*/
23
29
@Formatter (name: 'date' )
24
30
class Date implements Function {
@@ -36,15 +42,12 @@ class Date implements Function {
36
42
var _dfs = new Map <String , Map <String , DateFormat >>();
37
43
38
44
/**
39
- * [date] : Date to format either as Date object, milliseconds
40
- * ([string] or [num]) or various ISO 8601 datetime string formats
41
- * (e.g. `yyyy-MM-ddTHH:mm:ss.SSSZ` and its shorter versions like
42
- * `yyyy-MM-ddTHH:mmZ`, `yyyy-MM-dd` or `yyyyMMddTHHmmssZ`). If no
43
- * timezone is specified in the string input, the time is considered to
44
- * be in the local timezone.
45
+ * Format a value as a date.
45
46
*
46
- * [format] : Formatting rules (see Description). If not specified,
47
- * mediumDate is used
47
+ * - `date` : value to format as a date. If no timezone is specified in the string input,
48
+ * the time is considered to be in the local timezone.
49
+ * - `format` : Either a named format, or an explicit format specification. If no format is
50
+ * specified, mediumDate is used.
48
51
*
49
52
*/
50
53
dynamic call (Object date, [String format = 'mediumDate' ]) {
0 commit comments