Skip to content

Commit 8ba44bd

Browse files
authored
Merge branch 'main' into fix/issue-2912
2 parents e22cf47 + 430bdf3 commit 8ba44bd

98 files changed

Lines changed: 145 additions & 95 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions

biome.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@
3939
}
4040
},
4141
"overrides": [
42+
{
43+
"includes": ["packages/react-day-picker/src/locale/*.ts"],
44+
"linter": {
45+
"rules": {
46+
"style": {
47+
"noRestrictedImports": {
48+
"level": "error",
49+
"options": {
50+
"paths": {
51+
"date-fns/locale": "Import each locale from its date-fns locale subpath."
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}
58+
},
4259
{
4360
"includes": ["**/*.test.ts", "**/*.test.tsx"],
4461
"linter": {

packages/react-day-picker/src/DayPicker.test.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,33 @@ describe("when the `month` is changed programmatically", () => {
533533
});
534534
});
535535

536+
describe("when the timeZone changes after mount", () => {
537+
const defaultMonth = new Date("2024-01-01T00:30:00.000Z");
538+
let rerender: ReturnType<typeof render>["rerender"];
539+
540+
beforeEach(() => {
541+
({ rerender } = render(
542+
<DayPicker defaultMonth={defaultMonth} timeZone="America/New_York" />,
543+
));
544+
});
545+
546+
test("displays the month in the initial time zone", () => {
547+
expect(grid("December 2023")).toBeInTheDocument();
548+
});
549+
550+
describe("when the instant falls in the following month in the new time zone", () => {
551+
beforeEach(() => {
552+
rerender(
553+
<DayPicker defaultMonth={defaultMonth} timeZone="Europe/Berlin" />,
554+
);
555+
});
556+
557+
test("displays the month in the new time zone", () => {
558+
expect(grid("January 2024")).toBeInTheDocument();
559+
});
560+
});
561+
});
562+
536563
test("extends the default locale", () => {
537564
render(
538565
<DayPicker

packages/react-day-picker/src/locale/af.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { af as dateFnsAf } from "date-fns/locale";
1+
import { af as dateFnsAf } from "date-fns/locale/af";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar-DZ.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arDZ as dateFnsArDZ } from "date-fns/locale";
1+
import { arDZ as dateFnsArDZ } from "date-fns/locale/ar-DZ";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar-EG.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arEG as dateFnsArEG } from "date-fns/locale";
1+
import { arEG as dateFnsArEG } from "date-fns/locale/ar-EG";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar-MA.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arMA as dateFnsArMA } from "date-fns/locale";
1+
import { arMA as dateFnsArMA } from "date-fns/locale/ar-MA";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar-SA.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arSA as dateFnsArSA } from "date-fns/locale";
1+
import { arSA as dateFnsArSA } from "date-fns/locale/ar-SA";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar-TN.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arTN as dateFnsArTN } from "date-fns/locale";
1+
import { arTN as dateFnsArTN } from "date-fns/locale/ar-TN";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

packages/react-day-picker/src/locale/ar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ar as dateFnsAr } from "date-fns/locale";
1+
import { ar as dateFnsAr } from "date-fns/locale/ar";
22

33
import type { DateLibOptions, DayPickerLocale } from "../classes/DateLib.js";
44
import { DateLib } from "../classes/DateLib.js";

0 commit comments

Comments
 (0)