I have a date time string September 30, 2017 @ 11:23 am, which is parsable in chrome using:
var end = new Date("September 30, 2017 @ 11:23 am");
But in firefox it gives invalid date error. How do I parse it in Firefox?
I have a date time string September 30, 2017 @ 11:23 am, which is parsable in chrome using:
var end = new Date("September 30, 2017 @ 11:23 am");
But in firefox it gives invalid date error. How do I parse it in Firefox?
According to MDN
String value representing a date. The string should be in a format recognized by the Date.parse() method
Solution: You can simply remove @ from the stirng. using replace method or any other way.
Ex:
var d = "September 30, 2017 @ 11:23 am"
var end = new Date(d.replace("@",""));
console.log(end)
In both Firefox and chrome, removing the @ works. you could replace the @ symbol.
let date = 'September 30, 2017 @ 11:23 am'
new Date(date.replace('@', ''))