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

[pickers] When using DatePicker and LuxonAdapter, changing prop adapterLocale does not influence the keyboard mask. #6540

Closed
2 tasks done
slowWriting opened this issue Oct 17, 2022 · 4 comments · Fixed by #6547
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! l10n localization

Comments

@slowWriting
Copy link

slowWriting commented Oct 17, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version (alpha-3)

Current behavior 😯

When DatePicker is used together with LuxonThere there is a problem with using adapterLocale to influence the placeholder. It does not work. Additionally warning is shown:
Mask does not support numbers with variable length such as 'M'. Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop Falling down to uncontrolled no-mask input.

Context - #4755 (comment)

Expected behavior 🤔

Placeholder text should react to changing locale. Additionally no warnings in console would be nice.

Steps to reproduce 🕹

https://codesandbox.io/s/date-and-time-pickers-forked-fdfsxx?file=/src/App.tsx

Sorry for formatting, I created an issue from existing comment and there was template, my bad.

@slowWriting slowWriting changed the title Changing prop adapterLocale does not influence the keyboard mask. [pickers] Changing prop adapterLocale does not influence the keyboard mask. Oct 17, 2022
@slowWriting slowWriting changed the title [pickers] Changing prop adapterLocale does not influence the keyboard mask. [pickers] When using DatePicker and LuxonAdapter, changing prop adapterLocale does not influence the keyboard mask. Oct 17, 2022
@alexfauquette
Copy link
Member

Your issue is confusing because the "current behavior" is about the mask, and the "expected behavior" is about placeholder

About the mask warning, it is here to point the format used (default luxon one) contains a section with variable length. Those elements are not supported by the mask, so the mask behavior is disabled (as explained by the warning)

This problem will be fixed by fields components available in v6

About the placeholder, I confirm, it does not take into account the locale

Here is a demo with en/fr locales. The placeholder are the same, but the values are month/day/year and day.month/year

@alexfauquette alexfauquette added bug 🐛 Something doesn't work l10n localization component: pickers This is the name of the generic UI component, not the React module! labels Oct 17, 2022
@slowWriting
Copy link
Author

slowWriting commented Oct 17, 2022

@alexfauquette I have checked your example, and it seems that masking does not work with 'de' locale (it contains dots).
When I type 2 numbers, slash is shown in french locale, but in german nothing happens. Should I create another issue for that?

Your issue is confusing because the "current behavior" is about the mask, and the "expected behavior" is about placeholder

Right, I have mixed that two, I meant placeholder. I will fix that.

@alexfauquette
Copy link
Member

Not necessary to open an issue. It works because the french format is dd/mm/yyyy which is supported by mask For deutsh the default is d.mm.yyyy

For example, the 1st of October will be:

  • fr: 01/10/2022
  • de: 1.10.2022

The mask does not support this day format. If you used format="dd.mm.yyyy" the mask will be available

@flaviendelangle flaviendelangle added the feature: Mask editing Will be removed once we have the new field components. label Oct 17, 2022
@slowWriting
Copy link
Author

Indeed I have tested this on Edge using Hungarian locale - "hy" and as you say the masking works.
Strangely enough I have used Chrome first, but the browser is using wrong date formats, when using Intl.DateTimeFormat.

@alexfauquette alexfauquette removed the feature: Mask editing Will be removed once we have the new field components. label Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! l10n localization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants