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] - DatePicker internationalization behavior #2842

Closed
alirezatayebinejad opened this issue Apr 22, 2024 · 12 comments · Fixed by #3331
Closed

[BUG] - DatePicker internationalization behavior #2842

alirezatayebinejad opened this issue Apr 22, 2024 · 12 comments · Fixed by #3331
Assignees
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working

Comments

@alirezatayebinejad
Copy link

NextUI Version

2.3.5

Describe the bug

when I add Persian language to the datepicker it works fine but when I open the year input and scroll down the years then the months suddenly turn back to the default locale instead of the persian months

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

just do this and open year and keep scroll down the years untill you see the months changes


Expected behavior

do not change the month and it should stay in the desire locale

Screenshots or Videos

No response

Operating System Version

windows 10

Browser

Chrome

Copy link

linear bot commented Apr 22, 2024

@wingkwong
Copy link
Member

Can you share your code or a stackblitz link?

@alirezatayebinejad
Copy link
Author

alirezatayebinejad commented Apr 24, 2024

Can you share your code or a stackblitz link?


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

export default function App() {
  let [date, setDate] = React.useState<DateValue>(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>
  );
}

just run this and open the year and month selection start scrolling the years while watching the month after scrolling you will see the month words changes to another months system , it happens for other locals like Persian 'fa-IR'

@MhEsn
Copy link

MhEsn commented Jun 3, 2024

Hello there,
I exactly faced this issue. Did you fine any solution for that?

@wingkwong wingkwong added 🐛 Type: Bug Something isn't working 📦 Scope : Components Related to the components labels Jun 25, 2024
@wingkwong wingkwong self-assigned this Jun 25, 2024
@wingkwong
Copy link
Member

Just an update. I'm working on it.

@MhEsn
Copy link

MhEsn commented Jul 26, 2024

After updating to newer version it has weirder behavior with .

 <I18nProvider locale="fa-IR">
                    <DatePicker
                      showMonthAndYearPickers
                      value={form.birthDate}
                      name="birthDate"
                      label="birthDate"
                      onChange={(value) => {
                        handleForm("birthDate", value);
                      }}
                    />
                  </I18nProvider>

It completely shows the years wrong. For example it should shows 1350 as a year but it shows 2550, almost 1200 years later.

@Ehsan256
Copy link

Ehsan256 commented Aug 3, 2024

Any update for this issue? still has issue with "fa-IR" locale 😕.

@wingkwong
Copy link
Member

hey can u DM me at discord (id: wingkwong). i need to understand more on fa-IR.

@ErfanMowlavian
Copy link

ErfanMowlavian commented Aug 4, 2024

hey can u DM me at discord (id: wingkwong). i need to understand more on fa-IR.

is it fixed?

@wingkwong
Copy link
Member

@ErfanMowlavian I made a PR.

@amin-mousavi
Copy link

amin-mousavi commented Aug 4, 2024

date picker month and year problem in fa-IR solved? i need help
I have this problem in next UI date picker in persian

@wingkwong
Copy link
Member

wingkwong commented Aug 5, 2024

@amin-mousavi

  1. The PR is being under review
  2. please subscribe [BUG] - incorrect year in date picker in fa-IR #3602 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants