Date strings in the form "2011-01-27T04: 59: 00Z" - some browsers accept them, some do not. What for?

I get a date string in a form "2011-01-27T04:59:00Z"from a web service call. Firefox and Chrome have no problem parsing a string using var d = new Date("2011-01-27T04:59:00Z"), but Safari and IE will not stand behind it.

I can analyze the string myself and pass it to Date.parse()or Date.UTC(), but I wonder why (1) such a mismatch exists among browsers in something as basic as a Date object, and (2) why the open API returns a date string in a format that rejected by Safari and (especially) IE.

+3
source share
1 answer

There are two questions for you, I would say

  • pre-Browser War I. ECMAScript , , ( ) .
  • ISO 8601, Javascript Date. php php 5.0. Date , RFC 2822.

:

  • Date.prototype.parse , , . ECMAScript 3, , . 2009 ECMAScript 5 , Date ISO 8601, , , , Gecko/Firefox . (Webkit )
  • , ISO 8601 1988 , -/ . PHP date() 5. RFC 822/2822, .
  • , API Unix , .
+3

Source: https://habr.com/ru/post/1787982/


All Articles