Skip to content

Fix issue with DateInput #6693

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

Merged
merged 3 commits into from
Mar 27, 2023
Merged

Conversation

coltonw
Copy link
Contributor

@coltonw coltonw commented Mar 17, 2023

What does this PR do?

There is an issue in an inline ranged DateInput where if you type a date and then click that date in the calendar to deselect it, the component simply breaks. It will return nonsensical values to its onChange handler and will display NaN in the date text input. It is not recoverable from this state.

This PR fixes that issue.

Where should the reviewer start?

Testing in storybook I suppose.

What testing has been done on this PR?

It has been tested using a jest test and manually tested in storybook.

How should this be manually tested?

You can repro by going to this story: https://storybook.grommet.io/?path=/story/input-dateinput-format-inline--format-inline and then type a date and then click that date in the calendar to deselect it.

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Screenshots (if appropriate)

Screen Shot 2023-03-17 at 2 28 06 PM

Do the grommet docs need to be updated?

No

Should this PR be mentioned in the release notes?

Maybe?

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this and adding a test! This looks good to me

@ericsoderberghp ericsoderberghp merged commit e4400a6 into grommet:master Mar 27, 2023
@coltonw coltonw deleted the dateInputBug branch March 29, 2023 20:22
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.

3 participants