时刻返回错误的价值

时间:2016-03-02 19:22:16

标签: node.js momentjs

我使用momentjs解析日期:

var startDate = moment.utc('2016-02-20T07:00:00.000Z')

如果我将startDate.toISOString()写入控制台,我会得到:

2016-02-19T21:00:00.000Z

startDate对象如下所示:

{ [Number: 1455915600000]
  _isAMomentObject: true,
  _i: '2016-02-20T07:00:00.000Z',
  _f: 'YYYY-MM-DDTHH:mm:ss.SSSSZ',
  _tzm: -0,
  _isUTC: true,
  _pf: 
   { empty: false,
     unusedTokens: [],
     unusedInput: [],
     overflow: -1,
     charsLeftOver: 0,
     nullInput: false,
     invalidMonth: null,
     invalidFormat: false,
     userInvalidated: false,
     iso: true },
  _locale: 
   Locale {
     _ordinalParse: /\d{1,2}(th|st|nd|rd)/,
     ordinal: [Function],
     _abbr: 'en',
     _ordinalParseLenient: /\d{1,2}(th|st|nd|rd)|\d{1,2}/ },
  _d: Fri Feb 19 2016 22:00:00 GMT+0100 (CET),
  _isValid: true,
  _offset: 0 }

这种差异来自哪里?

0 个答案:

没有答案