Thursday 15 July 2010

Add number of days to Date object in jQuery always shows wrong days in a month -



Add number of days to Date object in jQuery always shows wrong days in a month -

i want able traverse through date object adding single day loop. when loop , add together single day date object per each iteration end 30 days in month no matter month seek (even february). must jquery isn´t strongest syntax i´m looking guys. due practical matters in project need show 30 days in view no matter date select.

how can add together single day per each iteration still preserving days in each month?

var date = new date(2014, 10, 10); (var = 0; < 30; i++) { // stuff date object ... abbreviated date.setdate(date.getdate() + 1); //i thought enough, oct showing 30 days //should utilize method when adding days? }

that's november. months 0-bases.

var date = new date(2014, 10, 10); console.log(date) > mon nov 10 2014 00:00:00 gmt-0500 (est)

from the docs:

var thebigday = new date(1962, 6, 7); // 1962-07-07

jquery

No comments:

Post a Comment