Fix KDateRange confusing selection states and end date reset after selecting start date via keyboard #888
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.
Description
This pull request addresses the KDateRange bug in which, after initially setting a Start Date in the textbox using the keyboard, selecting another date on the calendar results in the Start Date being reset.
This pull request also clears the End Date after selecting a Start Date, but only if the Start Date is after the End Date.
This feature is not replicated when using mouse clicks to select dates on the calendar view, as it would make it difficult to remove or restart the date range values.
Issue addressed
Addresses #817
Before/after screenshots
After:
Setting a start date in the text box, then clicking to select the end date on the calendar:
TextboxThenCalendar.mov
Selecting a start date that is before and after the end date:
StartDateRenew.mov
Changelog
Steps to test
(optional) Implementation notes
At a high level, how did you implement this?
The logic within
setStartDate()
was updated so that if the start date is after the end date, the end date isnull
, otherwise, it is unchanged.Within
KDateCalendar.vue
, a watcher has been added for the propsselectedStartDate
andselectedEndDate
, which will update the localdateRange
object values, so that the calendar dates are consistent with the updates made to the dates in the KDateRange textboxes.isFirstChoice
has been converted into a computed property and its value is updated based on changes to the dateRange object values.Testing checklist
Reviewer guidance