-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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): fix programmatic set of date in range mode #4814
Conversation
This change adds a logic to re-format dates in `<input>` when Flatpickr's `setDate()` API is called. Flatpickr's range plugin has a similar logic to do that, but runs only if the second argument is `true`. Fixes carbon-design-system#4803.
Deploy preview for carbon-elements ready! Built with commit 9ad7312 |
Deploy preview for the-carbon-components ready! Built with commit 9ad7312 https://deploy-preview-4814--the-carbon-components.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit 9ad7312 https://deploy-preview-4814--carbon-components-react.netlify.com |
@asudoh could you share more about this particular fix and why we needed to go down this route? Curious what your thoughts are on when we need to dive into the custom plugin versus what we can do in the component, and vice-versa (just due to my own lack of knowledge!) 🙏 |
Would @aledavila or @dakahn want to go through this with @asudoh at some point too? 👀 |
@joshblack yea I can join to go through it too |
I choose the plugin approach when the default behavior of Flatpickr does not align with what our design team dictates, or such default behavior is seen as a bug from our perspective. Another case is that such change is seen as it should apply to all framework variants. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, tested against the original codesandbox example and the input field no longer shows both parts of the date range
…esign-system#4814) This change adds a logic to re-format dates in `<input>` when Flatpickr's `setDate()` API is called. Flatpickr's range plugin has a similar logic to do that, but runs only if the second argument is `true`. Fixes carbon-design-system#4803.
…esign-system#4814) This change adds a logic to re-format dates in `<input>` when Flatpickr's `setDate()` API is called. Flatpickr's range plugin has a similar logic to do that, but runs only if the second argument is `true`. Fixes carbon-design-system#4803.
This change adds a logic to re-format dates in
<input>
when Flatpickr'ssetDate()
API is called. Flatpickr's range plugin has a similar logic to do that, but runs only if the second argument istrue
.Fixes #4803.
Changelog
New
setDate()
API call won't end up with<input>
populated with wrong date format.Testing / Reviewing
Testing should make sure our date picker is not broken.