When creating a date object with new Date(str);:
Google Chrome:
Firefox browser:
Internet Explorer:
It can be seen that the date generated under the ie browser is illegal. After consulting the data, it is found that ie does not support "-", while "/" is supported under all browsers, so the processing is as follows:
var str = "2018-05-02 20:00:00"; var dateStr = new Date(str.replace(/-/g,"/")); dateStrUse "/" to connect, all browsers are correct.