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 controlled date picker set to null #4459

Closed
wants to merge 3 commits into from

Conversation

origami-z
Copy link
Contributor

@origami-z origami-z commented Nov 28, 2024

#4344

Questions to be answered

  • Single date picker, when to callback date with undefined vs null vs Date (invalid vs valid)
    • e.g. clear input value to a empty string?
  • DateInputSingle
    • useEffect: sync input value state to the date state
      • why:
        1. when date is controlled to be null, we want to clear the input
        2. when date is controlled to be a valid date, we want the formatted input value in the input
        3. when date is controlled to be a invalid date, we want leave as it is
      • when:
        • option1: only when controlled input value prop changed, sync to internal date state
        • option2: remove sync logic from apply
  • DatePickerSingleInput vs DateInputSingle

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

changeset-bot bot commented Nov 28, 2024

⚠️ No Changeset found

Latest commit: 71909ce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saltdesignsystem ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2024 5:52pm

@@ -214,7 +214,7 @@ export const DateInputRange = forwardRef<
endInputRef: endInputRefProp,
locale,
parse: parseProp,
placeholder = "dd mmm yyyy",
placeholder = format,
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

Choose a reason for hiding this comment

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

ah.. the case has changed :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Casing actually matters, in certain library, lower case and upper case means different things.

@origami-z
Copy link
Contributor Author

replace by #4465

@origami-z origami-z closed this Nov 29, 2024
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.

None yet

2 participants