iOS vs Android: different dates displayed for the same program

空扰寡人 提交于 2020-01-16 05:10:26

问题


I have a javascript code:

newDate: function(days) {
    var newDate = new Date( parseInt(startDate) + 1*1000*3600);

    var date = newDate .getDate();
    return date ;
},

Seems like this is the part of the program that produces different results on Android and iOS. All the rest data is the same. How can it produce different results on Android vs iOS?


回答1:


The Date constructor is only consistent cross-browser for the following Date formats:

"2010"

"2010-06"

"2010-06-09"

"2010-06-09T15:20:00Z"

"2010-06-09T15:20:00-07:00"

"2010/06/09"

"2009/6/9"

"2010/6/9 12:34"

"2010/6/9 12:34:56"

"June 9, 2010"

"2010 June 9"

References

  • Cross-browser JavaScript Date parsing behavior

  • JavaScript Date Parsing Changes in ES6

  • How do I output an ISO 8601 formatted string in JavaScript?

  • Which date formats are IETF-compliant RFC 2822 timestamps?

  • Time Programming

  • Date Timestamp Guidelines (pdf)

  • Sources for time zone and daylight saving time data



来源:https://stackoverflow.com/questions/17528340/ios-vs-android-different-dates-displayed-for-the-same-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!