zhaojs
2023-10-07 74f6db362e1aacb440eacce84e9433de1368a51a
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
export function valueOf() {
    return this._d.valueOf() - (this._offset || 0) * 60000;
}
 
export function unix() {
    return Math.floor(this.valueOf() / 1000);
}
 
export function toDate() {
    return new Date(this.valueOf());
}
 
export function toArray() {
    var m = this;
    return [
        m.year(),
        m.month(),
        m.date(),
        m.hour(),
        m.minute(),
        m.second(),
        m.millisecond(),
    ];
}
 
export function toObject() {
    var m = this;
    return {
        years: m.year(),
        months: m.month(),
        date: m.date(),
        hours: m.hours(),
        minutes: m.minutes(),
        seconds: m.seconds(),
        milliseconds: m.milliseconds(),
    };
}
 
export function toJSON() {
    // new Date(NaN).toJSON() === null
    return this.isValid() ? this.toISOString() : null;
}