@@ -9,6 +9,12 @@ const Defaults = {
9
9
year : 'numeric'
10
10
} ,
11
11
dateTimeFormatterOptions : {
12
+ day : 'numeric' ,
13
+ month : 'numeric' ,
14
+ year : 'numeric' ,
15
+ hour : 'numeric' ,
16
+ minute : 'numeric' ,
17
+ second : 'numeric' ,
12
18
timeZone : "UTC" ,
13
19
timeZoneName : "short"
14
20
}
@@ -23,19 +29,23 @@ const I18N = {
23
29
numberFormatter : new Intl . NumberFormat ( ) ,
24
30
translate : null , // function(value: string, vars: array|object = null) : string
25
31
32
+ getDefaults ( ) {
33
+ return Defaults ;
34
+ } ,
35
+
26
36
setLocales ( locales , dateFormatterOptions = { } , dateTimeFormatterOptions = { } , numberFormatterOptions = { } , collatorOptions = { } ) {
27
37
this . locales = locales ;
28
38
29
- collatorOptions = Object . assign ( { } , this . collatorOptions , collatorOptions ) ;
39
+ collatorOptions = Object . assign ( { } , Defaults . collatorOptions , collatorOptions ) ;
30
40
this . collator = new Intl . Collator ( locales , collatorOptions ) ;
31
41
32
- dateFormatterOptions = Object . assign ( { } , this . dateFormatterOptions , dateFormatterOptions ) ;
42
+ dateFormatterOptions = Object . assign ( { } , Defaults . dateFormatterOptions , dateFormatterOptions ) ;
33
43
this . dateFormatter = new Intl . DateTimeFormat ( locales , dateFormatterOptions ) ;
34
44
35
- dateTimeFormatterOptions = Object . assign ( { } , this . dateTimeFormatterOptions , dateTimeFormatterOptions ) ;
45
+ dateTimeFormatterOptions = Object . assign ( { } , Defaults . dateTimeFormatterOptions , dateTimeFormatterOptions ) ;
36
46
this . dateTimeFormatter = new Intl . DateTimeFormat ( locales , dateTimeFormatterOptions ) ;
37
47
38
- numberFormatterOptions = Object . assign ( { } , this . numberFormatterOptions , numberFormatterOptions ) ;
48
+ numberFormatterOptions = Object . assign ( { } , Defaults . numberFormatterOptions , numberFormatterOptions ) ;
39
49
this . numberFormatter = new Intl . NumberFormat ( locales , numberFormatterOptions ) ;
40
50
} ,
41
51
0 commit comments