Javascript Date: next month

后端 未结 8 1479
情深已故
情深已故 2020-11-28 10:01

I\'ve been using Javascript\'s Date for a project, but noticed today that my code that previously worked is no longer working correctly. Instead of producing Feb as expected

8条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 10:15

    Instead, try:

    var now = new Date();
    current = new Date(now.getFullYear(), now.getMonth()+1, 1);
    

提交回复
热议问题