Skip to content
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

[Dateinput] Year Selector should be based on today, not current value of control #89

Closed
rroesler opened this issue Jun 22, 2010 · 3 comments

Comments

@rroesler
Copy link

Suggest this code

                // year selector
                var base = new Date();
                yearSelector.empty();                   
                for (var i = base.getFullYear() + conf.yearRange[0];  i <= base.getFullYear() + conf.yearRange[1]; i++) {
                    if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) {
                        yearSelector.append($("<option/>").text(i));
                    }
                }
@tipiirai
Copy link
Contributor

hmm. cannot really decide on which one is better. can you explain to me why present year is better than the selected year to motivate me.

@rroesler
Copy link
Author

rroesler commented Aug 5, 2010

Yes .. imaging that you have a yearRange such as [-100,0] for choosing birth dates. I select my birth date (19xx) and that become the new reference ? Now the next time the popup is displayed, the range is 19xx-100 to 19xx-0 instead on the original 2010-100 to 2010-0. If you had accidentally chosen a to-early year, there is no way to correct your entry because the yearRange is preventing later years from being chosen.

yearRange based on now makes some sense. So would a yearRange with real dates. And using min/max instead of yearRange wold also work,

@tipiirai
Copy link
Contributor

this is now fixed. here is the commit:

http://github.com/jquerytools/jquerytools/commit/d0bd5dc7a72c92a7e5eb03c67574c1afa40a921c

Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants