JS is not directly available functions, so can only write their own, which need to relate to the judgment of the number of days per month, if it is February, but also related to the judgement of leap years
1 varAdddate = {2 //date, based on the original date, increase days, by default 1 days3SetDate:function(date, days) {4 if(days = = Undefined | | days = = ") {5Days = 1;6 }7 varDate =Newdate (date);8Date.setdate (date.getdate () +Days );9 varmonth = Date.getmonth () + 1;Ten varDay =date.getdate (); One returnDate.getfullyear () + '-' + This. Getformatdate (month) + '-' + This. Getformatdate (day); A }, - //Date Month/day display, if 1 digits, precede with ' 0 ' -Getformatdate:function(ARG) { the if(arg = = Undefined | | arg = = ") { - return‘‘; - } - varRe = arg + '; + if(Re.length < 2) { -Re = ' 0 ' +re; + } A returnre; at } -}
JS month, date plus day