@@ -2,6 +2,20 @@ type t = Js.Date.t
2
2
3
3
type time = float
4
4
5
+ type localeOptions = {
6
+ dateStyle ?: [#full | #long | #medium | #short ],
7
+ timeStyle ?: [#full | #long | #medium | #short ],
8
+ weekday ?: [#long | #short | #narrow ],
9
+ era ?: [#long | #short | #narrow ],
10
+ year ?: [#numeric | # "2-digit" ],
11
+ month ?: [#numeric | # "2-digit" | #long | #short | #narrow ],
12
+ day ?: [#numeric | # "2-digit" ],
13
+ hour ?: [#numeric | # "2-digit" ],
14
+ minute ?: [#numeric | # "2-digit" ],
15
+ second ?: [#numeric | # "2-digit" ],
16
+ timeZoneName ?: [#long | #short ],
17
+ }
18
+
5
19
@send external valueOf : t => time = "valueOf"
6
20
7
21
@new external make : unit => t = "Date"
@@ -146,8 +160,19 @@ external setUTCMinutesSMs: (t, ~minutes: int, ~seconds: int, ~milliseconds: int)
146
160
@send external toTimeString : t => string = "toTimeString"
147
161
148
162
@send external toLocaleDateString : t => string = "toLocaleDateString"
163
+ @send external toLocaleDateStringWithLocale : (t , string ) => string = "toLocaleDateString"
164
+ @send
165
+ external toLocaleDateStringWithLocaleAndOptions : (t , string , localeOptions ) => string =
166
+ "toLocaleDateString"
149
167
@send external toLocaleString : t => string = "toLocaleString"
168
+ @send external toLocaleStringWithLocale : (t , string ) => string = "toLocaleString"
169
+ @send
170
+ external toLocaleStringWithLocaleAndOptions : (t , string , localeOptions ) => string = "toLocaleString"
150
171
@send external toLocaleTimeString : t => string = "toLocaleTimeString"
172
+ @send external toLocaleTimeStringWithLocale : (t , string ) => string = "toLocaleTimeString"
173
+ @send
174
+ external toLocaleTimeStringWithLocaleAndOptions : (t , string , localeOptions ) => string =
175
+ "toLocaleTimeString"
151
176
152
177
@send external toISOString : t => string = "toISOString"
153
178
@send external toUTCString : t => string = "toUTCString"
0 commit comments