Skip to content

Commit 74aa2b4

Browse files
committed
fix(hijri): use start/endMonth bounds in v10 branch
1 parent 66af073 commit 74aa2b4

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/hijri/index.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ describe("Hijri DayPicker", () => {
9595
expect(nextButton()).toHaveAttribute("aria-disabled", "true");
9696
});
9797

98-
test("clamps deprecated fromMonth below range", () => {
98+
test("clamps startMonth below range", () => {
9999
render(
100100
<DayPicker
101101
month={gregorianMinDate}
102-
fromMonth={new Date(1900, 0, 1)}
102+
startMonth={new Date(1900, 0, 1)}
103103
locale={enUS}
104104
dir="ltr"
105105
numerals="latn"
@@ -109,11 +109,11 @@ describe("Hijri DayPicker", () => {
109109
expect(previousButton()).toHaveAttribute("aria-disabled", "true");
110110
});
111111

112-
test("clamps deprecated toMonth above range", () => {
112+
test("clamps endMonth above range", () => {
113113
render(
114114
<DayPicker
115115
month={gregorianMaxDate}
116-
toMonth={new Date(2100, 0, 1)}
116+
endMonth={new Date(2100, 0, 1)}
117117
locale={enUS}
118118
dir="ltr"
119119
numerals="latn"

src/hijri/index.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,8 @@ export function DayPicker(
4444
},
4545
) {
4646
const { dateLib: dateLibProp, ...dayPickerProps } = props;
47-
const hasStartBound =
48-
props.startMonth !== undefined ||
49-
props.fromMonth !== undefined ||
50-
props.fromYear !== undefined;
51-
const hasEndBound =
52-
props.endMonth !== undefined ||
53-
props.toMonth !== undefined ||
54-
props.toYear !== undefined;
47+
const hasStartBound = props.startMonth !== undefined;
48+
const hasEndBound = props.endMonth !== undefined;
5549

5650
const clampedProps: typeof dayPickerProps = {
5751
...dayPickerProps,
@@ -64,8 +58,6 @@ export function DayPicker(
6458
endMonth: hasEndBound
6559
? clampDateProp(props.endMonth)
6660
: new Date(GREGORIAN_MAX_DATE),
67-
fromMonth: clampDateProp(props.fromMonth),
68-
toMonth: clampDateProp(props.toMonth),
6961
};
7062

7163
return (

0 commit comments

Comments
 (0)