0

I have found that new Date('2022-05-06 12:00:00') didn't work in IE11,only new Date('2022/05/06 12:00:00') works However,I have writen a lot of codes like that,so how can I make the Date fit the IE11 by rewrite the Date Class?

JokerSora
  • 7
  • 3
  • Rewrite the date class? – evolutionxbox May 06 '22 at 08:13
  • *"I have found that new Date('2022-05-06 12:00:00') didn't work in IE11"* It also isn't necessarily reliable in any other browser, as that isn't in the only officially-specified format. One browser might parse it as UTC, another as local time; or as you've found, a browser may even not parse it at all. You'll need to parse it yourself if you want to handle it consisstently cross-browser . – T.J. Crowder May 06 '22 at 08:15
  • Relevant: [What are valid Date Time Strings in JavaScript?](https://stackoverflow.com/q/51715259) It should be easier to fix your inputs instead of *rewriting the `Date` class*. It's one of those tasks that if you have to ask how to do, you most likely shouldn't do. – VLAZ May 06 '22 at 08:15
  • ok,I have solved it,by rewrite the date class to fix the ie11 – JokerSora May 06 '22 at 08:38

0 Answers0