nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - fa-IR locale in datepicker not working

Open esmailshahbazi opened this issue 1 year ago • 2 comments

NextUI Version

2.4.8

Describe the bug

months name and years do not changing when i set locale "fa-IR" for NextUIProvider and I18nProvider

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

months name and years do not changing when i set locale "fa-IR" for NextUIProvider and I18nProvider

Expected behavior

months name and years do not changing when i set locale "fa-IR" for NextUIProvider and I18nProvider

Screenshots or Videos

No response

Operating System Version

Windows

Browser

Chrome

esmailshahbazi avatar Oct 19 '24 13:10 esmailshahbazi

please provide a minimal reproducible environment

wingkwong avatar Oct 19 '24 13:10 wingkwong

please provide a minimal reproducible environment

for example in this screenshot you see i set locale hi-IN-u-ca-indian but months name and years are gregory bug bug2

and this is my provider.jsx <NextUIProvider> {children} </NextUIProvider>

numbers are persian because of my custom font in css

esmailshahbazi avatar Oct 21 '24 10:10 esmailshahbazi

Library version

@react-aria/i18n : 3.12.3 @internationalized/date: 3.5.6

NextUI Version 2.4.8

esmailshahbazi avatar Oct 21 '24 11:10 esmailshahbazi

  1. please paste the code here
  2. can you also share your NextUIProvider?

wingkwong avatar Oct 21 '24 11:10 wingkwong

  1. please paste the code here
  1. can you also share your NextUIProvider?

NextUIProvider

<NextUIProvider> {children} </NextUIProvider>

Codes

import React from "react";
import { DatePicker } from "@nextui-org/react";
import { now, parseAbsoluteToLocal } from "@internationalized/date";
import { I18nProvider } from "@react-aria/i18n";

export default function Test() {
  let [date, setDate] = React.useState(
    parseAbsoluteToLocal("2021-04-07T18:45:22Z")
  );

  return (
    <div className="flex flex-col gap-4">
      <I18nProvider locale="hi-IN-u-ca-indian">
        <DatePicker
          showMonthAndYearPickers
          variant="bordered"
          className="max-w-md"
          label="Appointment date"
          value={date}
          onChange={setDate}
        />
      </I18nProvider>
    </div>
  );
}

Library version

"@nextui-org/react": "^2.4.8", "@internationalized/date": "^3.5.6", "@react-aria/i18n": "^3.12.3",

esmailshahbazi avatar Oct 21 '24 12:10 esmailshahbazi

and im using next ui in next.js 14 with app router

esmailshahbazi avatar Oct 21 '24 13:10 esmailshahbazi

please provide a minimal reproducible environment

i think datepicker doesn't work correctly in next.js framework please check this out

https://codesandbox.io/p/devbox/nextui-datepicker-locale-fa-ir-2kd2h9

live share code

https://codesandbox.io/p/live/908cb369-f35f-423c-9743-5be7b267ff24

esmailshahbazi avatar Oct 22 '24 09:10 esmailshahbazi

Can anyone solve this problem? Is there any hope?

esmailshahbazi avatar Oct 24 '24 13:10 esmailshahbazi

I had a similar problem, downgrading @react-aria/i18n to version 3.11.1 solved the problem.

omidbaharifar avatar Oct 29 '24 21:10 omidbaharifar