Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

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

wants to merge 2 commits into from

Conversation

ghostd
Copy link

@ghostd 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 does not render proper month when yearRange does not include now
@ghostd
Copy link
Author

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];
        }

@mikesherov
Copy link
Member

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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants