changed range in datepicker to 100 years ago to current year
Hi @robotdan please review.
Can you describe the fix, what was broken and how did this fix it? Also, missing tests.
The fix: The start year(first year in the list) was 10 years before the current year. I changed it to 100 years before the current year. The end year(last year in the list) was 10 years after the current year. I changed it to be the current year. Earlier, we couldn't select the birth year, if the user is born before 2010. No point in displaying future years as well for this use case (However, it may be required for a case like "valid till" field, which uses this datepicker widget and would need to display future years as well).
Test case added.
From a library perspective, this is just a date picker, the usage of a birthday selector is a specific use case we have in FusionAuth.
So, the ability to select a future year, while it doesn't make sense for a birthday picker, it may for other usages. I would hesitate to hard code assuming it is going to be used for a birthday picker.
So there are a few options,
- Change the default (this is what you have here)
- Change the default and provide configuration to allow it to be customized
- Leave the existing values, and provide configuration to allow it to be customized
Thoughts?
Yeah, hardcoding it to show till the current year doesn't seem right to me either (last line in my previous comment). But providing configuration for start and end years sounds like overkill to me here. We can give the range from the last 100 to the next 100 years and that would solve most of the cases. Let me know what would you like to be done.