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

[BUG] - DateRangePicker error message not using NextUIProvider Locale #3693

Closed
SimonGodefroid opened this issue Aug 29, 2024 · 3 comments
Closed

Comments

@SimonGodefroid
Copy link

NextUI Version

2.4.2

Describe the bug

Set the locale in the NextUIProvider

  <NextUIProvider locale='en-GB'>{children}</NextUIProvider>

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Set the locale in the NextUIProvider

  <NextUIProvider locale='en-GB'>{children}</NextUIProvider>

Consume the DateRangePicker component

...
// from the docs
const min = today(getLocalTimeZone());
...
<DateRangePicker
  label="Start date - End date"
  minValue={min}
/>

Expected behavior

The error message should respect the provided's locale format.
ATM I receive Value must be 8/29/2024 or later. I expect instead Value must be 29/08/2024 or later.

Screenshots or Videos

image

Operating System Version

macOs

Browser

Chrome

Copy link

linear bot commented Aug 29, 2024

@macci001
Copy link
Contributor

macci001 commented Aug 29, 2024

Seems like validation messages which includes the date needs to be modified by the next-ui.
The validation messages obtained from the react-aria are created by the browser, hence the custom locale would not work here. The date in error message will contain the locale of the browser.

I am not sure if there is any hack for this to get the validation message according to the custom locale.

I am putting in a PR to fix this.

@ryo-manba
Copy link
Member

Thanks for the issue. If you'd like to set the validation message using a locale other than the browser's, please handle it using the errorMessage prop. You can refer to the following for more details: #3694 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants