Skip to content

Commit

Permalink
[@mantine/dates] MonthPicker: Fix infinite useEffect with use-form in…
Browse files Browse the repository at this point in the history
… some cases (#7389)
  • Loading branch information
openscript authored Jan 26, 2025
1 parent bb6f692 commit 66e3020
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const MonthPicker: MonthPickerComponent = factory<MonthPickerFactory>((_p
onLevelChange={onLevelChange as any}
{...others}
date={shiftTimezone('add', others.date, ctx.getTimezone(), __timezoneApplied)}
__timezoneApplied
/>
);
}) as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function useDatesState<Type extends DatePickerType = 'default'>({
return;
}

if (_value[0] && !_value[1]) {
if (_value[0] && !_value[1] && pickedDate?.getTime() !== _value[0].getTime()) {
setPickedDate(_value[0]);
} else {
const isNeitherSelected = _value[0] == null && _value[1] == null;
Expand Down

0 comments on commit 66e3020

Please sign in to comment.