Skip to content

Commit

Permalink
🐛 useDatepicker håndterer isInvalid validation riktig (#2809)
Browse files Browse the repository at this point in the history
* 🐛 useDatepicker håndterer isInvalid validation riktig nå

* Update @navikt/core/react/src/date/hooks/useDatepicker.tsx

* Update @navikt/core/react/src/date/hooks/useDatepicker.tsx
  • Loading branch information
KenAJoh authored Mar 20, 2024
1 parent bb87837 commit d1606d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/large-wombats-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-react": patch
---

useDatePicker: `isInvalid`-key i onValidate var hadde flipper boolean i noen tilfeller
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const UseDatepicker = () => {
fromDate: new Date("Aug 23 2019"),
toDate: new Date("Feb 23 2024"),
onDateChange: console.log,
onValidate: console.log,
});

return (
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/react/src/date/hooks/useDatepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const useDatepicker = (
) {
updateDate(undefined);
updateValidation({
isInvalid: isValidDate(day),
isInvalid: !isValidDate(day),
isWeekend: disableWeekends && isWeekend(day),
isDisabled: disabled && isMatch(day, disabled),
isValidDate: false,
Expand Down

0 comments on commit d1606d3

Please sign in to comment.