Why do I get wrong result from function?

前端 未结 2 574
伪装坚强ぢ
伪装坚强ぢ 2021-01-26 01:48

I has this objects array:

var data=[{Id:540, MeasureDate:\"2016-06-27T15:06:47\"},
          {Id:541, MeasureDate:\"2016-06-27T12:24:39\"}];

I

2条回答
  •  渐次进展
    2021-01-26 02:17

    The reason is you don't have a timezone specified in your ISO8601 timestamp. Chrome defaults to UTC and and IE to local when it is not specified (or the other way around, I forget).

    You can either:

    a) add 'Z' to the end of your timestamp to specify UTC or add another timezone ( see wikipedia for valid formats https://en.m.wikipedia.org/wiki/ISO_8601)

    b) use momentjs which I believe will standardize the behavior across the browsers.

提交回复
热议问题