How can i set Year range for a jQuery Date Picker: 1900 to current year, or 1900 to 9999

Developer picture Developer · Nov 21, 2011 · Viewed 49.5k times · Source

Hi all i used the Jquery Date picker which works well enough for me. But i am having a small issue i.e i would like to set the Start year from 1900 and End year to Current Year or 9999..

In the script i found this for year range

yearRange: 'c-100:c+100'

If i move forward to some thing like 1800 i am unable to see the current year.. What changes should i do here in order to see my years in a such a way that the years should be 1900-current year or 1900-9999

I tried this which works for me but as it is loading when the calendar loads it taking much time when my application runs

 datepick({yearRange: '1900:9999'});

So any better option than this to achieve as per my requirement

Answer

malificent picture malificent · Dec 23, 2011

try this:

datepick({yearRange: '1900:' + new Date().getFullYear()});