datepicker - JavaScript date math not working -


i have searched forum , found many useful answers, 1 of answers used works under conditions.

i populating week calendar, , need determine start of week (monday) date picker, , add date populate text fields following 6 days. works if date picker selection in same month.

so, if select wednesday may 15th 2013, correctly returns , populates monday may 13, tuesday may 14, etc.

but, if select wednesday may 1, 2013, correctly populates monday apr 29, tuesday puts may 30 (adding month instead of day).

i should note building in application craft, don't know if has impact.

here's code:

var curr = new date(app.getvalue("datepicker2")); // selected date var first = curr.getdate() - curr.getday() +1; // adjust monday start of week var firstday = new date(curr.setdate(first)); var secondday = new date(); secondday.setdate(firstday.getdate()+1); 

can see have gone wrong?

thanks

tammy

here

secondday.setdate(firstday.getdate()+1)

since specifying date in setdate function, assume "this" month happens may in case

so, can

secondday = new date(firstday.getfullyear(), firstday.getmonth(), firstday.getdate()+1) 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -