-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] The field does not work when the format is only composed of escaped characters #10279
Comments
Hi, Thanks for your feedback. We are not supporting formats with 0 non-escaped token. |
My use case is that when users select a date, I want to highlight the entire week and display the first and last day of the week, not the selected day itself. For example, if a user selects September 19, the DatePicker would display September 17 - September 23. Currently, I'm calculating those dates separately and passing them into the format prop. |
Make sense |
Thank you so much! |
I'd like to see this feature as well. We use a |
I think that if your input does not allow editing, then it should not be an input. But if you do want to keep an input, then the solution proposed here would work fine. As for correct editing of the weeks though the fields and the views, maybe one day we will provide a clean week picker 👍 |
Closes by #10307 |
How did we do @noelleabe? |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/embed/mui-x-issue-template-forked-gs9ck7
Steps:
DatePicker
orMobileDatePicker
inside aLocationProvider
and provide adateAdapter
.format
prop that's completely composed of escaped characters. For example, if using adapterMoment, setformat="[test]"
DatePicker
.format
prop, add an acceptable token. For example, if using adapterMoment, setformat="[test] Y"
.DatePicker
.Current behavior 😯
When formatted text in a
DatePicker
orMobileDatePicker
is all escaped characters, nothing is displayed. When the formatted text uses a token in addition to escaped characters, the text is correctly displayed.Expected behavior 🤔
Formatted text that is all escaped characters should be displayed regardless of whether a token exists.
Context 🔦
I want to display the first and last day of the week in a
DatePicker
. Since a week can start and end in different months or years, no tokens from the value are used.Your environment 🌎
npx @mui/envinfo
System:
OS: macOS 12.3
Binaries:
Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
Yarn: Not Found
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
Browsers:
Chrome: 116.0.5845.179
Edge: 116.0.1938.76
Safari: 15.4
npmPackages:
typescript: ^5.3.0-dev.20230817 => 5.3.0-dev.20230830
Order ID or Support key 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: