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

Controls: Fix edge case in datetime control #14348

Merged
merged 2 commits into from
Mar 30, 2021

Conversation

gabiseabra
Copy link
Contributor

Issue: #13771

What I did

Mutating a Date object with setMonth and setDate will validate and potentially adjust it by rolling into the next month if the resulting month has fewer days than the resulting day.

I've modified the date change callback in each date-time component to apply changes in one step with setFullYear instead of separate steps for year/month/day.

How to test

  • Serve storybooks and navigate to official-storybooks > Controls > Date > Basic
  • Change date to 31/01/2021
  • Change date to 28/02/2021
  • It shouldn't change to 28/03/2021

  • Is this testable with Jest or Chromatic screenshots? ❌
  • Does this need a new example in the kitchen sink apps? ❌
  • Does this need an update to the documentation? ❌

If your answer is yes to any of these, please make sure to include it in your PR.

@shilman shilman changed the title [fix] edge case in datetime type knob Controls: Fix edge case in datetime control Mar 29, 2021
@shilman shilman merged commit 5595b1e into storybookjs:next Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants