[fix] DateInput: normalize selected dates to start-of-day to honor max#12295
Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom Aug 22, 2025
Merged
[fix] DateInput: normalize selected dates to start-of-day to honor max#12295sfc-gh-bnisco merged 1 commit intodevelopfrom
sfc-gh-bnisco merged 1 commit intodevelopfrom
Conversation
Contributor
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a date validation issue in the DateInput component where BaseWeb's quick select feature returns Date objects anchored at midday (12:00) while min/max bounds are set to midnight, causing same-day end dates to be incorrectly flagged as exceeding the maximum allowed date.
Key changes:
- Date normalization: Added
normalizeToStartOfDay()function to ensure all selected dates are set to 00:00 before validation - Validation updates: Modified both
handleChangeandupdateWidgetMgrStateto normalize dates before validation - Test coverage: Added comprehensive unit test with time mocking to verify quick select ranges ending "today" are accepted without errors
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
frontend/lib/src/components/widgets/DateInput/DateInput.tsx |
Added date normalization logic to fix midday vs midnight validation issues |
frontend/lib/src/components/widgets/DateInput/DateInput.test.tsx |
Added test case with Date/moment mocking to verify quick select behavior |
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.
Describe your changes
00:00inhandleChangebefore validation and state updates.updateWidgetMgrStatebefore validation.maxset to today and no error icon is shown.moment.nowandDate, avoiding fake timers that interfere with BaseWeb popovers.GitHub Issue Link (if applicable)
Fixes #12293
Ref #10166, #10764
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.