PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/moment/src/lib/moment/to-type.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 34 lines | 28 code | 5 blank | 1 comment | 1 complexity | a9a157015440a8cf630c8430692c32fd MD5 | raw file
 1export function valueOf () {
 2    return this._d.valueOf() - ((this._offset || 0) * 60000);
 3}
 4
 5export function unix () {
 6    return Math.floor(this.valueOf() / 1000);
 7}
 8
 9export function toDate () {
10    return new Date(this.valueOf());
11}
12
13export function toArray () {
14    var m = this;
15    return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
16}
17
18export function toObject () {
19    var m = this;
20    return {
21        years: m.year(),
22        months: m.month(),
23        date: m.date(),
24        hours: m.hours(),
25        minutes: m.minutes(),
26        seconds: m.seconds(),
27        milliseconds: m.milliseconds()
28    };
29}
30
31export function toJSON () {
32    // new Date(NaN).toJSON() === null
33    return this.isValid() ? this.toISOString() : null;
34}