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

前端 未结 4 533
被撕碎了的回忆
被撕碎了的回忆 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:24

    Just use slashes instead of hyphens if you can.


    EDIT: Expanded clarification...

    The ISO 8601 standard format uses the hyphen as a date separator. My answer does not mean you do not need to follow standards. You can use slashes only for the Date constructor if necessary.

提交回复
热议问题