Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DatePicker): updated onBlur logic for empty date #9373

Merged
merged 3 commits into from
Aug 8, 2023

Conversation

thatblindgeye
Copy link
Contributor

What: Closes #8779

Originally had added logic to call setError if pristine && isRequired, but that would have required a consumer to always pass in a validator to validators array; something along the lines of validators={[(date) => !date ? 'Date cannot be blank' : '']}.

Just adding a new isRequired and emptyDateText props will make it easier for consumers, and it avoids a case of isRequired being passed in but an error message never appearing if a validator isn't passed in.

This is somewhat dependent on #9267, but should just require a slight tweak in that PRs code (the value === '' && setErrorText('') line)

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented Jul 18, 2023

Copy link
Contributor

@edonehoo edonehoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

adamviktora added a commit to adamviktora/patternfly-react that referenced this pull request Jul 31, 2023
@thatblindgeye thatblindgeye changed the base branch from postV5 to main July 31, 2023 18:42
@tlabaj tlabaj requested a review from nicolethoen August 1, 2023 20:53
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tlabaj tlabaj merged commit 088be06 into patternfly:main Aug 8, 2023
10 checks passed
adamviktora added a commit to adamviktora/patternfly-react that referenced this pull request Aug 18, 2023
thatblindgeye pushed a commit that referenced this pull request Aug 24, 2023
* fix(DatePicker): clear error on date reset

* feat(DatePicker): add clear date example to controlled DatePicker

* test(DatePicker): add integration test for clear date

* feat(DatePicker): update clear date logic based on #9373

* fix(DatePicker): hide error when date cleared and not required + show error when cleared and required

* refactor(DatePicker)

* fix(DatePicker): prop removal
nicolethoen pushed a commit to Kells512/patternfly-react that referenced this pull request Sep 1, 2023
* fix(DatePicker): updated onBlur logic for empty date

* Updated example description

* Grouped isRequired and emptyDateText props as one
nicolethoen pushed a commit to Kells512/patternfly-react that referenced this pull request Sep 1, 2023
…y#9267)

* fix(DatePicker): clear error on date reset

* feat(DatePicker): add clear date example to controlled DatePicker

* test(DatePicker): add integration test for clear date

* feat(DatePicker): update clear date logic based on patternfly#9373

* fix(DatePicker): hide error when date cleared and not required + show error when cleared and required

* refactor(DatePicker)

* fix(DatePicker): prop removal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug - DatePicker - onBlur is not called on all field changes
6 participants