| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 |  
 
 
 
 
 
 
 
 
 
 
 
 
1×
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1×
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  | /*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
 
/**
 * List of possible format for the date-picker converted to their mask.
 *
 * Not fully implemented yet
 */
export const formatToMask = {
    M: null,
    Mo: null,
    MM: [/[0|1]/, /\d/],
    MMM: null,
    MMMM: null,
    Q: null,
    Qo: null,
    D: null,
    Do: null,
    DD: [/[0-3]/, /\d/],
    DDD: null,
    DDDo: null,
    DDDD: null,
    d: null,
    do: null,
    dd: null,
    ddd: null,
    dddd: null,
    e: null,
    E: null,
    w: null,
    wo: null,
    ww: null,
    W: null,
    Wo: null,
    WW: null,
    YY: [/\d/, /\d/],
    YYYY: [/[1|2]/, /\d/, /\d/, /\d/],
    Y: null,
    gg: null,
    gggg: null,
    GG: null,
    GGGG: null,
    A: null,
    a: null,
    H: null,
    HH: [/\d/, /\d/],
    h: null,
    hh: [/\d/, /\d/],
    k: null,
    kk: null,
    m: null,
    mm: [/\d/, /\d/],
    s: null,
    ss: [/\d/, /\d/],
    S: null,
    SS: null,
    SSS: null,
    z: null,
    zz: null,
    Z: null,
    ZZ: null,
    X: null,
    x: null,
} as {[f: string]: any[]};
 
export const formatToUnitOfTime = {
    M: null,
    Mo: null,
    MM: 'month',
    MMM: null,
    MMMM: null,
    Q: null,
    Qo: null,
    D: null,
    Do: null,
    DD: 'day',
    DDD: null,
    DDDo: null,
    DDDD: null,
    d: null,
    do: null,
    dd: null,
    ddd: null,
    dddd: null,
    e: null,
    E: null,
    w: null,
    wo: null,
    ww: null,
    W: null,
    Wo: null,
    WW: null,
    YY: 'year',
    YYYY: 'year',
    Y: null,
    gg: null,
    gggg: null,
    GG: null,
    GGGG: null,
    A: null,
    a: null,
    H: null,
    HH: 'hour',
    h: null,
    hh: 'hour',
    k: null,
    kk: null,
    m: null,
    mm: 'minute',
    s: null,
    ss: 'second',
    S: null,
    SS: null,
    SSS: null,
    z: null,
    zz: null,
    Z: null,
    ZZ: null,
    X: null,
    x: null,
} as {[f: string]: string};
 
  |