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

[fields] Format "D MM YYYY" does not as expected #10065

Open
2 tasks done
attilavargatelus opened this issue Aug 17, 2023 · 3 comments
Open
2 tasks done

[fields] Format "D MM YYYY" does not as expected #10065

attilavargatelus opened this issue Aug 17, 2023 · 3 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@attilavargatelus
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:

Steps:

  1. Set format to "D.MM.YYYY"

Current behavior 😯

If I use the format "D.MM.YYYY", the picker format the output like "01.08.2023".

Expected behavior 🤔

If I use the format "D.MM.YYYY", I would expect the output to be like "1.08.2023".

Context 🔦

We want to use multiple locals in out project, with dayjs. We tested the app with mk local, which uses the "D.MM.YYYY" format.

Your environment 🌎

npx @mui/envinfo System: OS: Windows 10 10.0.19045 Binaries: Node: 20.3.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.203) npmPackages: @emotion/react: ^11.11.1 => 11.11.1 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.11 @mui/core-downloads-tracker: 5.14.5 @mui/lab: ^5.0.0-alpha.138 => 5.0.0-alpha.140 @mui/material: ^5.14.3 => 5.14.5 @mui/private-theming: 5.14.5 @mui/styled-engine: 5.13.2 @mui/system: 5.14.5 @mui/types: 7.2.4 @mui/utils: 5.14.5 @mui/x-date-pickers: ^6.11.1 => 6.11.1 @types/react: 18.2.20 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.0.4 => 5.1.6

Order ID or Support key 💳 (optional)

No response

@attilavargatelus attilavargatelus added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 17, 2023
@zannager zannager added the component: pickers This is the name of the generic UI component, not the React module! label Aug 17, 2023
@LukasTy
Copy link
Member

LukasTy commented Aug 17, 2023

Thank you for creating this issue. 🙏
Have you looked at the shouldRespectLeadingZeros prop? 🤔
Here is the documentation for the mentioned prop.

It should help you see the desired result, based on the format, but be aware that it will have implications if you rely on HTML form data value parsing.
If you only rely on the generic value/onChange API, there shouldn't be any implications. 👌

@flaviendelangle Do you agree that it would be worth having a documentation section about it?
It might already be a 3rd issue regarding this topic... 🙈

@LukasTy LukasTy removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 17, 2023
@LukasTy LukasTy changed the title Format "D MM YYYY" does not as expected [fields] Format "D MM YYYY" does not as expected Aug 17, 2023
@cmark1302
Copy link

cmark1302 commented Aug 17, 2023

@LukasTy

Also, when i try to type 12 in MM, it enters as 01 in MM and 02 in DD

@LukasTy
Copy link
Member

LukasTy commented Aug 18, 2023

Also, when i try to type 12 in MM, it enters as 01 in MM and 02 in DD

Please provide a minimal reproduction test case with the latest version. This would help a lot. 🙏
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

flaviendelangle Do you agree that it would be worth having a documentation section about it?
It might already be a 3rd issue regarding this topic... 🙈

Sorry for the confusion. I somehow forgot about this section... 🙈

@LukasTy LukasTy added the status: waiting for author Issue with insufficient information label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

4 participants