开发者

How to increment jquery ui datepicker programmatically

Basically I want to take date from one field and then increment day and set it to another date field.

This is kind of psuedo-code:

var date1 = $( '#date1' ).datepicker( 'getDate' );
开发者_运维问答
var incrementDate = date1 + 1 //increment day

$( '#date2' ).datepicker('setDate', incrementDate );


var date1 = $('#date1').datepicker('getDate');

var date = new Date( Date.parse( date1 ) ); 
date.setDate( date.getDate() + 1 );

var newDate = date.toDateString(); 
newDate = new Date( Date.parse( newDate ) );

$('#date2').datepicker('setDate', newDate );


var date = new Date($('#date1').datepicker('getDate'));
date.setDate(date.getDate() - 1);
$('#date1').datepicker('setDate', date);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜