File tree 6 files changed +60
-38
lines changed
6 files changed +60
-38
lines changed Original file line number Diff line number Diff line change @@ -360,18 +360,6 @@ class Dayjs {
360
360
return new Date ( this . $d )
361
361
}
362
362
363
- toArray ( ) {
364
- return [
365
- this . $y ,
366
- this . $M ,
367
- this . $D ,
368
- this . $H ,
369
- this . $m ,
370
- this . $s ,
371
- this . $ms
372
- ]
373
- }
374
-
375
363
toJSON ( ) {
376
364
return this . toISOString ( )
377
365
}
@@ -383,18 +371,6 @@ class Dayjs {
383
371
return this . $d . toISOString ( )
384
372
}
385
373
386
- toObject ( ) {
387
- return {
388
- years : this . $y ,
389
- months : this . $M ,
390
- date : this . $D ,
391
- hours : this . $H ,
392
- minutes : this . $m ,
393
- seconds : this . $s ,
394
- milliseconds : this . $ms
395
- }
396
- }
397
-
398
374
toString ( ) {
399
375
return this . $d . toUTCString ( )
400
376
}
Original file line number Diff line number Diff line change
1
+ export default ( o , c ) => {
2
+ const proto = c . prototype
3
+ proto . toArray = function ( ) {
4
+ return [
5
+ this . $y ,
6
+ this . $M ,
7
+ this . $D ,
8
+ this . $H ,
9
+ this . $m ,
10
+ this . $s ,
11
+ this . $ms
12
+ ]
13
+ }
14
+ }
15
+
Original file line number Diff line number Diff line change
1
+ export default ( o , c ) => {
2
+ const proto = c . prototype
3
+ proto . toObject = function ( ) {
4
+ return {
5
+ years : this . $y ,
6
+ months : this . $M ,
7
+ date : this . $D ,
8
+ hours : this . $H ,
9
+ minutes : this . $m ,
10
+ seconds : this . $s ,
11
+ milliseconds : this . $ms
12
+ }
13
+ }
14
+ }
15
+
Original file line number Diff line number Diff line change @@ -12,16 +12,6 @@ declare namespace dayjs {
12
12
type OpUnitTypeShort = 'w'
13
13
export type OpUnitType = UnitType | "week" | OpUnitTypeShort ;
14
14
15
- interface DayjsObject {
16
- years : number
17
- months : number
18
- date : number
19
- hours : number
20
- minutes : number
21
- seconds : number
22
- milliseconds : number
23
- }
24
-
25
15
class Dayjs {
26
16
constructor ( config ?: ConfigType )
27
17
@@ -67,14 +57,10 @@ declare namespace dayjs {
67
57
68
58
toDate ( ) : Date
69
59
70
- toArray ( ) : number [ ]
71
-
72
60
toJSON ( ) : string
73
61
74
62
toISOString ( ) : string
75
63
76
- toObject ( ) : DayjsObject
77
-
78
64
toString ( ) : string
79
65
80
66
utcOffset ( ) : number
Original file line number Diff line number Diff line change
1
+ import { PluginFunc } from 'dayjs'
2
+
3
+ declare const plugin : PluginFunc
4
+ export = plugin
5
+
6
+ declare module 'dayjs' {
7
+ interface Dayjs {
8
+ toArray ( ) : number [ ]
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ import { PluginFunc } from 'dayjs'
2
+
3
+ declare const plugin : PluginFunc
4
+ export = plugin
5
+
6
+ interface DayjsObject {
7
+ years : number
8
+ months : number
9
+ date : number
10
+ hours : number
11
+ minutes : number
12
+ seconds : number
13
+ milliseconds : number
14
+ }
15
+
16
+ declare module 'dayjs' {
17
+ interface Dayjs {
18
+ toObject ( ) : DayjsObject
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments