Reputation: 2579
Creating date using dynamically generated date string throws invalid date
message only in IE11
.
Example
var today = new Date();
var ag_endDate = new Date(today).toLocaleDateString('en-US');
var final = new Date(ag_endDate);
console.log(final);
Upvotes: 2
Views: 1684
Reputation: 68393
try this
var dateObj = new Date();
var usFormatDate = dateObj.toLocaleDateString('en-US');
console.log( usFormatDate );
sorry, my bad! date
constructor does take date
Object as parameter.
However, if your intention is to simply get the formatted date
in en-US
locale, then you don't have to create another date
object for the same.
Upvotes: 2