fix(DatePicker): disable the Today button when today's date is disabled#599
Merged
Conversation
| it('should not disable today button when today is selectable', () => { | ||
| fixtureEl.innerHTML = '<div></div>' | ||
| const div = fixtureEl.querySelector('div') | ||
| const dateRangePicker = new DateRangePicker(div, { // eslint-disable-line no-unused-vars |
Coverage Report for CI Build 29268009803Coverage increased (+0.06%) to 94.704%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
In the Date Picker, clicking the Today button selected today's date even when today was a disabled date (excluded by
minDate/maxDateordisabledDates). The disabled-date guard only ran on the text-input path, not on the Today button, so users could pick a disabled date.Fix
Disable the Today button when
isDateDisabled(new Date(), minDate, maxDate, disabledDates)is true — the same check already used on the input path. Applies to both DatePicker and DateRangePicker (they share the footer).Tests
Added specs asserting the Today button is disabled when today is out of range and enabled otherwise.
Cross-framework parity: same fix ported to coreui-react-pro and coreui-vue-pro. Angular has no built-in Today button (consumer-supplied footer template), so it is not affected.