Bugfix/#412, #452 - Fix out-of-bounds options when building the month/year selects #455
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, when building the month select, the current month was taken out of the available options from the generated range (bound between
startDate
/0
andendDate
/11
). However, when the selected date range was in the same month asendDate
, for all months after theendDate
's month, the select would no longer display the proper current month, as it was no longer visible in the available options.This issue was presented in #412. However, the fix introduced there, which modified the available months range, breaks the month select, because it always limits the range to the current month, not allowing the user to select months past the currently visible month in the picker. This issue is reported in #452.
The proper fix was to update the select builder so that it can display disabled options, thus allowing the selected month to be displayed in the dropdown and properly build the control, without allowing the user to actually select that option. This should make the control more robust and keep the user happy.
Closes #412. Closes #452.
JSFiddle showcasing the fixed version.