UNPKG

3.13 kBJavaScriptView Raw
1/**
2 * Dateformat in schema helps DataModel to recognize DateTime (temporal) data. A variable is of type temporal can be
3 * specified in schema
4 * ```
5 * { name: 'name_of_variable', 'type': 'dimension', subtype: 'temporal' };
6 * ```
7 * DataModel recognizes two date format without specifying the `dateformat` property in schema
8 * - Date in miliseconds from epoch date i.e. the result of `new Date(2012, 10, 20).getDate()`
9 * - Instance of JavaScript `Date`
10 *
11 * For any other date format, the format needs to be specified. Following are the tokens available to specify the
12 * format.
13 * <table>
14 * <tr>
15 * <th>Token</th>
16 * <th>Description</th>
17 * <th>Example</th>
18 * </tr>
19 * <tr>
20 * <td>%H</td>
21 * <td>24-hour format of an hour with leading zeros</td>
22 * <td>00 through 23</td>
23 * </tr>
24 * <tr>
25 * <td>%l</td>
26 * <td>12-hour format of an hour with leading zeros</td>
27 * <td>01 through 12</td>
28 * </tr>
29 * <tr>
30 * <td>%p</td>
31 * <td>Uppercase Ante meridiem and Post meridiem</td>
32 * <td>am or pm</td>
33 * </tr>
34 * <tr>
35 * <td>%p</td>
36 * <td>Lowercase Ante meridiem and Post meridiem</td>
37 * <td>AM or PM</td>
38 * </tr>
39 * <tr>
40 * <td>%M</td>
41 * <td>Minutes with leading zeros</td>
42 * <td>00 to 59</td>
43 * </tr>
44 * <tr>
45 * <td>%S</td>
46 * <td>Seconds, with leading zeros</td>
47 * <td>00 to 59</td>
48 * </tr>
49 * <tr>
50 * <td>%a</td>
51 * <td>A textual representation of a day, three letters</td>
52 * <td>Mon through Sun</td>
53 * </tr>
54 * <tr>
55 * <td>%A</td>
56 * <td>A full textual representation of the day of the week</td>
57 * <td>Sunday through Saturday</td>
58 * </tr>
59 * <tr>
60 * <td>%e</td>
61 * <td>Day of the month without leading zeros</td>
62 * <td>1 to 31</td>
63 * </tr>
64 * <tr>
65 * <td>%d</td>
66 * <td>Day of the month, 2 digits with leading zeros</td>
67 * <td>01 to 31</td>
68 * </tr>
69 * <tr>
70 * <td>%b</td>
71 * <td>A short textual representation of a month, three letters</td>
72 * <td>Jan through Dec</td>
73 * </tr>
74 * <tr>
75 * <td>%B</td>
76 * <td>A full textual representation of a month, such as January or March</td>
77 * <td>January to December</td>
78 * </tr>
79 * <tr>
80 * <td>%m</td>
81 * <td>Numeric representation of a month, with leading zeros</td>
82 * <td>01 through 12</td>
83 * </tr>
84 * <tr>
85 * <td>%y</td>
86 * <td>A two digit representation of a year</td>
87 * <td>90 for 1990</td>
88 * </tr>
89 * <tr>
90 * <td>%Y</td>
91 * <td>A full numeric representation of a year, 4 digits</td>
92 * <td>1990</td>
93 * </tr>
94 * </table>
95 *
96 * In order to make DataModel recognize `1990-Sep-25` the format specification will be `%Y-%b-%e`.
97 *
98 * @public
99 * @namespace DataModel
100 */