fef4341560b031a4663c79f80aefcc09205242b24c92b7615b5ea6d26ea3ad18d612f08d907ca644ea8b70b8fc593c2c2f4c4ce0c7ed082385c0e58846daa7 834 B

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