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

Datepicker does not pass all props to flatpickr #7823

Closed
KristerL opened this issue Feb 17, 2021 · 0 comments · Fixed by #7834
Closed

Datepicker does not pass all props to flatpickr #7823

KristerL opened this issue Feb 17, 2021 · 0 comments · Fixed by #7834

Comments

@KristerL
Copy link

What package(s) are you using?

  • [ x ] carbon-components
  • [ x ] carbon-components-react

Detailed description

Describe in detail the issue you're having.

Cannot pass props to flatpicker, because Datepicker component overwrites locale prop.

Is this issue related to a specific component?

Yes, Datepicker component

What did you expect to happen? What happened instead? What would you like to
see changed?

I would like to change the start of the weekday from Sunday to Monday. I noticed in the code that the Datepicker props should get passed to flatpicker. In flatpicker the start of the weekday can be defined with the locale prop, but in the Datepicker component, the locale prop is overwritten and type-checked only against locale codes.

Ideally, we should be able to pass the props to flatpicker - https://flatpickr.js.org/localization/ as such:
locale: { firstDayOfWeek: 2 }

But it seems that locale is overwritten by the date picker thus this extra option cannot be passed to flatpicker: https://github.com/carbon-design-system/carbon/blob/master/packages/react/src/components/DatePicker/DatePicker.js#L303

I would like to be able to change the start of weekday. Ideally, everything that flatpicker takes in should be passable to it.

Maybe there is another way to do it?

What browser are you working in?

Chrome

What version of the Carbon Design System are you using?

"carbon-components": "^10.27.0",
"carbon-components-react": "^7.27.0"

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants