Reputation: 11
It works in other web browser but IE11 returns Invalid Date.
In order to debug I used below code.
console.log('before - ' + date.value);
date.value = new Date(date.value);
console.log('after - ' + date.value);
IE11 Console
before -1958-08-21 00:00:00.0
after -Invalid Date
Chrom Version 75.0.3770.80
before -1958-08-21 00:00:00.0
after -Thu Aug 21 1958 00:00:00 GMT-0700 (Pacific Daylight Time)
Upvotes: 0
Views: 170
Reputation: 57709
I think
new Date("1958-08-21 00:00:00.0");
is a non-standard way to use the function.
new Date("1958-08-21T00:00:00.0");
works in IE11. (I added the T
).
According to MDN:
A string value representing a date, specified in a format recognized by the Date.parse() method (these formats are IETF-compliant RFC 2822 timestamps and also strings in a version of ISO8601).
Upvotes: 2