Datepicker: handling yearRange when generating the HTML (fixes #7782) #521

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants

ghostd commented Nov 8, 2011

Datepicker: handling yearRange when generating the HTML (fixes #7782: Datepicker does not render proper month when yearRange does not include now

There is one weird thing in the current code (was here before this patch):
why _generateHTML initializes 'currentDate' with new Date(9999, 9, 9) instaed of new Date() ?

Datepicker: handling yearRange when generating the HTML (fixes #7782:…
… Datepicker does not render proper month when yearRange does not include now

ghostd commented Nov 8, 2011

Not sure what is the expected behavior, according to http://bugs.jqueryui.com/ticket/4641, yearRange and maxDate should be independant, so maybe

        if (yearRange) {
            var years = this._getYearRange(yearRange, minDate, maxDate);
            maxDate = maxDate ? maxDate : currentDate;
            maxDate = new Date(years[1], maxDate.getMonth() + 1, maxDate.getDate());
        }

should be

        if (yearRange) {
            var years = this._getYearRange(yearRange, minDate, maxDate);
            drawYear = years[1];
        }
Member

mikesherov commented Nov 10, 2012

As kbwood points out here: http://bugs.jqueryui.com/ticket/4641 "The yearRange setting just restricts the years that appear in the drop-down list. If you only want people to select dates within these years, you must use the minDate and maxDate settings."

http://bugs.jqueryui.com/ticket/7782 is a duplicate of that ticket, and so this is a wontfix. Thanks for the contribution anyway, and please feel free to submit more pull requests for any of the other bugs in our tracker: http://bugs.jqueryui.com/

@mikesherov mikesherov closed this Nov 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment