File tree 3 files changed +11
-1
lines changed
3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export default {
35
35
dayjs: {
36
36
locales: [' en' , ' ja' ],
37
37
defaultLocale: ' en' ,
38
+ defaultTimeZone: ' Asia/Taipei' ,
38
39
plugins: [
39
40
' utc' // import 'dayjs/plugin/utc'
40
41
] // Your Day.js plugin
Original file line number Diff line number Diff line change @@ -16,7 +16,12 @@ function dayjsModule(moduleOptions) {
16
16
plugins : [
17
17
...( this . options . dayjs . plugins || [ ] ) ,
18
18
...( moduleOptions . plugins || [ ] ) ,
19
- ]
19
+ ] ,
20
+ defaultTimeZone : (
21
+ moduleOptions . defaultTimeZone ||
22
+ this . options . dayjs . defaultTimeZone ||
23
+ null
24
+ )
20
25
}
21
26
22
27
this . addPlugin ( {
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ import dayjs from 'dayjs'
8
8
dayjs . locale ( '<%= options.defaultLocale %>' )
9
9
< % } % >
10
10
11
+ < % if ( options . defaultTimeZone ) { % >
12
+ dayjs . tz . setDefault ( '<%= options.defaultTimeZone %>' )
13
+ < % } % >
14
+
11
15
export default ( context , inject ) = > {
12
16
context . $dayjs = dayjs
13
17
inject ( 'dayjs' , dayjs )
You can’t perform that action at this time.
0 commit comments