views:

56

answers:

2

PetersenDidIt did a great job answering this question.

He showed how to use a link to update the jQueryUI Datepicker's selected date by one day. His solution was:

$('a#next').click(function () {
var $picker = $("#datepicker");
var date=new Date($picker.datepicker('getDate'));
date.setDate(date.getDate()+1);
$picker.datepicker('setDate', date);
return false;
});

I am trying to modify it to do the same thing for a week or month. According to the set date api I should be able to use "+1m" and "+1w" to skip a month or week. I can't seem to get the code working with anything other than "+1".

Thoughts?

A: 

Try using FireBug script debugging. Might be some JS exception being generated.

Ankit Jain
+4  A: 

you can use the same code you have. when you want one week do like this:

date.setDate(date.getDate()+7); 

when you want one month you can do:

date.setMonth(date.getMonth()+1); 
guy schaller