问题
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