Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

datepicker minimal year

I have a DatePicker minimum year is 2000 and needs to be done so that the minimum year was equal to, well, for example, 1910

alt text

$(" .datepicker").datepicker({dateFormat: 'dd.mm.yy', changeYear: true, changeMonth: true});

How to do it?

like image 816
Жасулан Бердибеков Avatar asked Dec 27 '10 08:12

Жасулан Бердибеков


People also ask

How do I restrict date in DatePicker?

You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).

How do I set a DatePicker range?

Steps to add Datepicker – $(document). ready(function(){ $("#setMin,#setMax"). datepicker({ dateFormat: "yy-mm-dd" }); $('#datepicker'). datepicker({ dateFormat: "yy-mm-dd", maxDate:'+1m +10d', minDate: -10 }); });

How do I reduce the size of my DatePicker?

By default DatePicker has standard height and width (height: '30px' and width: '143px'). You can change this height and width by using height and width property respectively.


2 Answers

Try clicking on year 2000. And then try selecting year again. You should be able to select 1990. And you can repeat that 10 times.

Or, use the yearRange option. More info here.

Example:

$( ".selector" ).datepicker({ yearRange: '1910:2010' });
like image 160
darioo Avatar answered Oct 28 '22 23:10

darioo


Try this:

$(function() {
    $( "#datepickerID" ).datepicker({   
        dateFormat: 'dd/mm/yy',
        changeMonth: true,
        changeYear: true,
        yearRange: '1930:2014'
    });
});
like image 43
offboard Avatar answered Oct 28 '22 23:10

offboard