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

With date-fns adapter, date picker date formatting for days of month < 10 always has zero padding, even when format specifies otherwise. #12386

Closed
palfvin opened this issue Mar 8, 2024 · 2 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it

Comments

@palfvin
Copy link

palfvin commented Mar 8, 2024

Steps to reproduce

Link to live example (based on documentation example)

https://codesandbox.io/embed/recursing-shockley-xshcg6?fontsize=14&hidenavigation=1&theme=dark

Current behavior

Using the datefnsv3 localization adapter (at least), the day of month shows with zero padding for days < 10 when the "d" specifier is used in the value of the format prop.

Expected behavior

There should be no zero padding for days < 10.

Context

I don't want zero padding.

Your environment

npx @mui/envinfo
  I used the Chrome browser
  System:
    OS: macOS 14.3.1
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 122.0.6261.112
    Edge: Not Found
    Safari: 17.3.1
  npmPackages:
    @emotion/react: ^11.11.4 => 11.11.4 
    @emotion/styled: ^11.11.0 => 11.11.0 
    @mui/base:  5.0.0-beta.38 
    @mui/core-downloads-tracker:  5.15.12 
    @mui/material: ^5.15.12 => 5.15.12 
    @mui/private-theming:  5.15.12 
    @mui/styled-engine:  5.15.11 
    @mui/system:  5.15.12 
    @mui/types:  7.2.13 
    @mui/utils:  5.15.12 
    @mui/x-date-pickers: ^6.19.6 => 6.19.6 
    @types/react:  18.2.62 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript:  4.8.4 

Search keywords: date-picker date-fns format

Search keywords:

@palfvin palfvin added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 8, 2024
@oliviertassinari oliviertassinari transferred this issue from mui/material-ui Mar 9, 2024
@LukasTy
Copy link
Member

LukasTy commented Mar 11, 2024

Hello @palfvin
It is the behavior we have decided upon to have less headache when working with FormData.
If you specifically need a format without leading zeros, please check this documentation section for more information.

I'm closing this issue as it's the expected behavior. 😉
If you feel that there is still something wrong with it—feel free to reopen the issue.

@LukasTy LukasTy closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
Copy link

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @palfvin?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

@LukasTy LukasTy added status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it component: pickers This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 11, 2024
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: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it
Projects
None yet
Development

No branches or pull requests

2 participants