Skip to content

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented Aug 27, 2025

@sai6855 sai6855 marked this pull request as draft August 27, 2025 17:24
@mui-bot
Copy link

mui-bot commented Aug 27, 2025

Deploy preview: https://deploy-preview-19357--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 🔺+79B(+0.03%) 🔺+14B(+0.02%)
@mui/x-date-pickers-pro 🔺+79B(+0.02%) 🔺+15B(+0.02%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 🔺+4B(+0.02%)

Details of bundle changes

Generated by 🚫 dangerJS against ff865c4

@sai6855 sai6855 added type: bug It doesn't behave as expected. scope: pickers Changes related to the date/time pickers. labels Aug 27, 2025
@sai6855 sai6855 marked this pull request as ready for review August 27, 2025 18:31
@sai6855 sai6855 requested a review from LukasTy August 27, 2025 18:31
@flaviendelangle
Copy link
Member

I would try the same bug with other adapters.
If Date Fns is not the same, then for me the solution is to not call adapter.format or adapter.formatByString without values rather than handling it inside the method itself.

@sai6855
Copy link
Contributor Author

sai6855 commented Aug 28, 2025

I would try the same bug with other adapters. If Date Fns is not the same, then for me the solution is to not call adapter.format or adapter.formatByString without values rather than handling it inside the method itself.

Done 👍

@@ -244,18 +244,23 @@ function getSectionValueText(
switch (section.type) {
case 'month': {
if (section.contentType === 'digit') {
return adapter.format(adapter.setMonth(adapter.date(), Number(section.value) - 1), 'month');
const dateWithMonth = adapter.setMonth(adapter.date(), Number(section.value) - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasTy I'm not sure what the behavior should be when we try to generate the aria-valuetext of a value with invalid sections (for example 99 in the day).

Right now the PR removes the property.
Another approach would be to return the raw value of the section but I guess it doesn't add value compared to not setting the property.

@flaviendelangle flaviendelangle changed the title [pickers] Gracefully handle invalid values when AdapterDateFns is used [pickers] Support invalid section values to generate aria-valuetext Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pickers] datepicker with date-fns fails when a large number is pasted on a section and returns an "invalid time value" error.
3 participants