开发者

Include min and max date in jquery calendar

开发者 https://www.devze.com 2023-02-06 19:38 出处:网络
I am having the following code, how can I add the min and开发者_C百科 max date as well? $(\"#DatePicker\").datepicker({ dateFormat: \'dd-M-yy\', altField: \'dd-M-yy\', altFormat: \'d/m/y\'});

I am having the following code, how can I add the min and开发者_C百科 max date as well?

   $("#DatePicker").datepicker({ dateFormat: 'dd-M-yy', altField: 'dd-M-yy', altFormat: 'd/m/y'});


$("#DatePicker").datepicker({
        dateFormat: 'dd-M-yy',
        altField: 'dd-M-yy',
        altFormat: 'd/m/y',
        minDate: new Date(2007, 1 - 1, 1),
        maxDate: '+1m +1w'
    });


taken straight from jQuery UI, the place you should have bookmarked in your browser. (and probably looked at first)

Restrict the range of selectable dates with the minDate and maxDate options. Set the beginning and end dates as actual dates (new Date(2009, 1 - 1, 26)), as a numeric offset from today (-20), or as a string of periods and units ('+1M +10D'). For the last, use 'D' for days, 'W' for weeks, 'M' for months, or 'Y' for years.

$("#datepicker").datepicker({ minDate: -20, maxDate: "+1M +10D" });


Add this attribute.

yearRange: '1960:2011'
0

精彩评论

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