Javascript Date(dateString) returns NaN on specific server and browser

前端 未结 4 557
被撕碎了的回忆
被撕碎了的回忆 2021-01-12 04:41

I\'m using the Javascript Date(string) constructor with a date format of \"yyyy-mm-dd\". The constructor works just fine in IE 9 and Firefox unless the app is running on our

4条回答
  •  日久生厌
    2021-01-12 05:20

    It's because of the date format. For some reason, IE and Safari get tripped up with yyyy-mm-dd. Use another date format and you should be all set.

    It's talked about here:
    http://biostall.com/javascript-new-date-returning-nan-in-ie-or-invalid-date-in-safari

提交回复
热议问题