user2089255
user2089255

Reputation: 87

Jquery datepicker goes to 1954 after 2013

Help! My datepicker is going to 1954 after dec. 2013. I need the datepicker to go at least a full year ahead of whatever the "current date" would be. I dont know what the deal is with this code, but this is what I have.

var cur_year=(new Date().getFullYear())
var cur_month = (new Date().getMonth())


                $(function(){
                var pickerOpts = {
                    showOn: "button",
                    buttonImage: "/images/calendar.png",
                    buttonImageOnly: true,
                    changeMonth: true,
                    changeYear: true,
                    yearRange: "-60:+0"
                }; 
                 $(".date_box").datepicker(pickerOpts);

});

I got rid of a bunch of extra crap, so the brackets may be wrong. I simply need the date to continue on to the next year after Dec 2013. Next year I need it to go to 2014 after Dec 2014.

Upvotes: 0

Views: 161

Answers (2)

Stobor
Stobor

Reputation: 45132

Just guessing, but:

1954 - 2013:

           yearRange: "-60:+0"

1959 - 2014:

            yearRange: "-55:+1"

1954 - 2018:

            yearRange: "-60:+5"

Upvotes: 3

nnnnnn
nnnnnn

Reputation: 150040

Have you tried this:

yearRange: "-60:+1"

If you need it to go even further, change +1 to a higher number.

As per the doco, yearRange sets:

The range of years displayed in the year drop-down: either relative to today's year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn"). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.

Upvotes: 4

Related Questions