nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.39k stars 1.39k forks source link

[BUG] - en-GB locale not show dd/MM/yyyy in Date picker #3604

Open duyvinh229148 opened 1 month ago

duyvinh229148 commented 1 month ago

NextUI Version

2.4.6

Describe the bug

My project using Nextjs, in layout, I use <NextUIProvider locale={"en-GB"}>{children}, but when using DatePicker, the date is still showing MM/dd/yyyy, while I google 'en-GB', the date format is 'dd/MM/yyyy'. I realy need that date format, because my country hate MM/dd/yyyy

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Create a Nextjs project
  2. In root layout.tsx, wrap children with LayoutUseClient component
  3. In LayoutUseClient component, wrap children with <NextUIProvider locale={"en-GB"}>{children}
  4. In a page.tsx file, use DatePicker component, seeing that the date format is still MM/dd/yyyy

Expected behavior

The date format is dd/MM/yyyy

Screenshots or Videos

No response

Operating System Version

Linux - Fedora 39

Browser

Chrome

linear[bot] commented 1 month ago

ENG-1248 [BUG] - en-GB locale not show dd/MM/yyyy in Date picker

awesome-pro commented 1 month ago

@duyvinh229148 I used this code , and datePicker appears to be in dd/mm/yyyy format.

  1. kindly check configurations or rebuild the project
  2. if still the issues persists provide sandbox showing error
 <NextUIProvider
      locale="en-GB"
      navigate={(path: string) => {
        router.push(path);
      }}
    >
      <NextThemesProvider {...themeProps}>{children}</NextThemesProvider>
    </NextUIProvider>
danieltan007 commented 3 weeks ago

here are the codesandbox link: codesandbox

wingkwong commented 3 weeks ago

may also check with other locales as well, e.g. en-US. ref: https://github.com/nextui-org/nextui/issues/3636

thaynarbo commented 2 weeks ago

pt-BR is also not working for dd/MM/yyyy which is our default format

LucasTrombim commented 2 weeks ago

pt-BR doesnt work either

LucasTrombim commented 2 weeks ago

@thaynarbo eu pesquisei sobre como o react-aria funciona, e o problema é a linguagem do seu navegador. Ele atualiza a formatação do campo de acordo com a linguagem do navegador. Teste com o navegador em português.

English:

@wingkwong I researched how react-aria works, and the problem is your browser language. It updates the field formatting according to the browser language. Test with the browser in Portuguese. This is the only "solution" that I have found.