dohomi / react-hook-form-mui

Material-UI form components ready to use with react-hook-form
https://react-hook-form-material-ui.vercel.app
MIT License
561 stars 111 forks source link

`@mui/x-date-pickers` v 7.17 cause "Attempted import error: 'validateDate' is not exported from '@mui/x-date-pickers/internals'" #310

Closed Skarvion closed 1 month ago

Skarvion commented 2 months ago

Duplicates

Latest version

Current behavior 😯

In a NextJS project, when using the latest @mui/x-date-pickers package v 7.17 and then build, the following warning message is raised

Attempted import error: 'validateDate' is not exported from '@mui/x-date-pickers/internals'

Honestly, I don't know what the actual impact when testing it, but the warning message is a bit concerning whereas last week it wasn't there.

See https://github.com/mui/mui-x/pull/14486 that moves the validateDate export from @mui/x-date-pickers/internals to @mui/x-date-pickers/validation

I suppose an easy fix is to use the new import path, but since that PR introduces a new validation hook, I'll leave it up to your discretion how to fix import issue.

For now, to avoid the error, I can use older version of @mui/x-date-pickers

Expected behavior 🤔

-

Steps to reproduce 🕹

Steps:

  1. Create a NextJS project (probably can use vanilla React project, but I haven't test)
  2. Install @mui/x-date-pickers@7.17.0
  3. Add <DatePickerElement>
  4. Build
  5. Warning message in console
sadik-malik commented 2 months ago

@Skarvion <DatePickerElement> uses the validateDate function internally to perform date-related validation. MUI, in this commit, has changed the import path for validateDate from @mui/x-date-pickers/internals to @mui/x-date-pickers/validation.

@dohomi, this change will not be backward compatible if we implement it.

dohomi commented 2 months ago

Ok thanks for pointing this out.

jesade-vbg commented 1 month ago

Hi! Any workaround?

Skarvion commented 1 month ago

Hi! Any workaround?

npm install @mui/x-date-pickers@7.16.0