javascript date + 7 days

前端 未结 10 677
孤城傲影
孤城傲影 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:42

    Using the Date object's methods will could come in handy.

    e.g.:

    myDate = new Date();
    plusSeven = new Date(myDate.setDate(myDate.getDate() + 7));
    

提交回复
热议问题