(new Date('2012-12-01')).getMonth() === 10?

后端 未结 3 1207
梦毁少年i
梦毁少年i 2021-01-18 08:35

(new Date(\'2012-12-01\')).getMonth() is 10 instead of 11 (getMonth is 0-indexed). I\'ve tested on Firefox, Chrome, and N

3条回答
  •  别那么骄傲
    2021-01-18 09:19

    For Firefox's case, at least, RFC2822 states that date specifications must be separated by Folding White Space. Try (new Date('2012 12 01')).getMonth(); Usage of - as a separator does not appear to be defined.

提交回复
热议问题