javascript - Why Date.parse() methods works for invalid string "foo 01.01.01" -
i have doubt regarding javascript date.parse method, below code example
var datestring = "foo 01.01.01"; date.parse(datestring)
this returns value (978287400000) expect nan can perform invalid date check below.
isnan(datestring.gettime())
my question how above string valid date string? per mdn link below should return nan.
https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/date/parse
thanks, michael
from page link to:
a string representing rfc2822 or iso 8601 date (other formats may used, results may unexpected).
from the spec page links to:
if string not conform format function may fall implementation-specific heuristics or implementation-specific date formats.
Comments
Post a Comment