javascript date + 7 days

前端 未结 10 675
孤城傲影
孤城傲影 2020-12-02 14:18

What\'s wrong with this script?

When I set my clock to say 29/04/2011 it adds 36/4/2011 in the week input! but the correct date should be 6/

10条回答
  •  渐次进展
    2020-12-02 14:54

    Two problems here:

    1. seven_date is a number, not a date. 29 + 7 = 36
    2. getMonth returns a zero based index of the month. So adding one just gets you the current month number.

提交回复
热议问题