Skip to content

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:

@thatblindgeye thatblindgeye requested a review from edonehoo July 18, 2023 15:39
@thatblindgeye thatblindgeye linked an issue Jul 18, 2023 that may be closed by this pull request
@thatblindgeye thatblindgeye force-pushed the iss8779_datePicker_onBlur branch from 92263f2 to ad46e4d Compare July 18, 2023 15:50
@patternfly-build
Copy link
Contributor

patternfly-build commented Jul 18, 2023

@thatblindgeye thatblindgeye force-pushed the iss8779_datePicker_onBlur branch from ad46e4d to 6d659bb Compare July 21, 2023 14:08
@thatblindgeye thatblindgeye requested a review from edonehoo July 21, 2023 14:09
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
@thatblindgeye thatblindgeye force-pushed the iss8779_datePicker_onBlur branch from 6d659bb to 96bce1d Compare July 31, 2023 18:42
@tlabaj tlabaj requested a review from nicolethoen August 1, 2023 20:53
@thatblindgeye thatblindgeye force-pushed the iss8779_datePicker_onBlur branch from 96bce1d to c62c19c Compare August 8, 2023 13:21
@thatblindgeye thatblindgeye requested a review from tlabaj August 8, 2023 13:22
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
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