-
Notifications
You must be signed in to change notification settings - Fork 309
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
chore: added minDate and maxDate checks in the datepicker #3060
Conversation
✅ Deploy Preview for carbon-components-angular ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/** | ||
* The minimum date that a user can start picking from. | ||
*/ | ||
@Input() minDate: string | number; | ||
|
||
/** | ||
* The maximum date that a user can pick to. | ||
*/ | ||
@Input() maxDate: string | number; | ||
|
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.
Hey @rkkp1023, this was intentionally excluded. At the time of the component creation, it was decided that we weren't going to create explicit wrapper inputs due to the possibility of changes upstream (flatpickr). If we start adding flatpickrOptions as inputs, we will then need to add ALL.
Instead, please pass the maxDate/minDate as part of the flatpickrOptions.
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.
Thanks, @Akshat55, Added flatpickerOptions in the storybook
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.
@Akshat55, Q: why the Carbon Angular implementation needs to differ from other implementations - both React and Web Component implementations support minDate/maxData as input properties.
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.
We tend to follow React implementation for the most part, however there are certain components that we decided to not 100% follow in terms of implementation. Date picker is one of those components.
Date picker is dependent on a third-party library (flatpickr), so it doesn't make sense for us to add all of those inputs/outputs in case there is a change in flatpickr.
In such case, to resolve this, we would need to phase it out via breaking changes, so the reasonable thing to do on our end was allow for a user to pass in a flatpickr options object.
That being said, I definitely think we do need to improve our storybook documentation to better showcase this.
🎉 This PR is included in version 5.56.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #3059
This PR will add the minDate and maxDate to the flatpicker options for the story book
Changelog
New