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][DateTimeRangePicker] Polish locale from dayjs breaks datetime format in DateTimeRangePicker since v.7.10.0 #14334

Closed
oskarkk opened this issue Aug 25, 2024 · 3 comments · Fixed by #14341
Assignees
Labels
bug 🐛 Something doesn't work component: DateTimeRangePicker The React component component: pickers This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user

Comments

@oskarkk
Copy link

oskarkk commented Aug 25, 2024

Steps to reproduce

Link to live example:
Correct in 7.9.0: https://codesandbox.io/p/sandbox/mui-daterangepicker-format-issue-7-9-0-jg2c5f
Incorrect in 7.10.0: https://codesandbox.io/p/sandbox/mui-datetimerangepicker-format-issue-7-10-0-6hdc22
Incorrect in 7.14.0: https://codesandbox.io/p/sandbox/mui-datetimerangepicker-format-issue-latest-cdnst2

The issue appears when using polish locale:

      <LocalizationProvider
        dateAdapter={AdapterDayjs}
        adapterLocale={dayjs.locale("pl")}
      >
        <DateTimeRangePicker<Dayjs>
          value={[dayjs("2020-02-02T00:00:00"), dayjs("2020-02-03T00:00:00")]}
          slots={{ field: SingleInputDateTimeRangeField }}
          sx={{ "& .MuiInputBase-root": { width: "250px" } }}
        />
      </LocalizationProvider>

Current behavior

On x-date-pickers version >= 7.10.0 the picker displays date in format 02 00:00 – 03 00:00, not showing month and year.

Expected behavior

On x-date-pickers version <= 7.9.0 the picker was working correctly displaying format: 02.02.2020 00:00 – 03.02.2020 00:00

Context

No response

Your environment

Version that works:
"dayjs": "1.11.13",
"@mui/material": "5.16.7",
"@mui/x-date-pickers-pro": "7.9.0"

Version that doesn't work:
"dayjs": "1.11.13",
"@mui/material": "5.16.7",
"@mui/x-date-pickers-pro": "7.10.0"

Search keywords: locale, dayjs
Order ID: Order 80141

@oskarkk oskarkk added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 25, 2024
@github-actions github-actions bot added the component: pickers This is the name of the generic UI component, not the React module! label Aug 25, 2024
@arthurbalduini
Copy link
Member

Hello @oskarkk,

Thanks for reporting it and providing complete information and examples. I can confirm it is a bug, probably coming from #13743
We will investigate the solution and try to push a fix as soon as possible.

@arthurbalduini
Copy link
Member

While we work on the fix, attributing the format prop perhaps works for you as a workaround:

<DateTimeRangePicker<Dayjs>
    value={[dayjs("2020-02-02T00:00:00"), dayjs("2020-02-03T00:00:00")]}
    format="DD/MM/YYYY HH:mm"
    slots={{ field: SingleInputDateTimeRangeField }}
    sx={{ "& .MuiInputBase-root": { width: "250px" } }}
/>

@LukasTy LukasTy added plan: Pro Impact at least one Pro user component: DateTimeRangePicker The React component labels Aug 29, 2024
Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@oskarkk: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

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: DateTimeRangePicker The React component component: pickers This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants