Javascript date parsing bug - fails for dates in June (??)

后端 未结 5 464
鱼传尺愫
鱼传尺愫 2020-12-18 04:28

I have some javascript which parses an ISO-8601 date. For some reason, it is failing for dates in June. But dates in July and May work fine, which doesn\'t make sense to m

5条回答
  •  一生所求
    2020-12-18 05:10

    Looks like a bug?

    C:\Documents and Settings\me>java org.mozilla.javascript.tools.shell.Main
    Rhino 1.7 release 2 2009 03 22
    js> date = new Date();
    Fri Jul 31 2009 15:18:38 GMT-0400 (EDT)
    js> date.setUTCMonth(5); date.toUTCString();
    Wed, 01 Jul 2009 19:18:38 GMT
    js> date.setUTCMonth(5); date.toUTCString();
    Mon, 01 Jun 2009 19:18:38 GMT
    

    EDIT: Nevermind I guess. Question already answered by somebody more knowledgable.

提交回复
热议问题