Skip to content

Commit

Permalink
Fikser bug i Datepicker (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrhein authored Oct 28, 2024
1 parent bfc8eb5 commit 56dcef4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-walls-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kvib/react": patch
---

Fiks for onChange i Datepicker som ikke ble trigget
5 changes: 0 additions & 5 deletions apps/storybook/.storybook/docs-root.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ input[type="range"]::-webkit-slider-thumb:active {
overflow: hidden;
}

#downshift-0-menu {
margin-left: -15px !important; /* storybook setter -20px her, det er alt for mye */
margin-right: -20px !important; /* storybook setter -20px her, det er alt for mye */
}

.toc-wrapper {
padding: 0 12px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type Story = StoryObj<typeof KvibDatepicker>;
export const Preview: Story = {
args: {
placeholder: "Velg dato",
onChange: v => console.log("Datepicker changed", v),
onChange: v => console.log("Du endret dato i Datepicker til " + v.target.value),
"aria-label": "Datepicker example",
},
render: args => <KvibDatepicker {...args} />,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/datepicker/Datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const CustomDatepicker = forwardRef<DatepickerProps, "input">(
const effectiveOnChange = (event: ChangeEvent<HTMLInputElement>) => {
// Then, call the onChange from props if it the input is valid
const dateStr = event.target.value;
const parsedDate = parse(dateStr, "yyyy-MM-dd", new Date());
const parsedDate = parse(dateStr, "dd.MM.yyyy", new Date());
if (isValid(parsedDate)) {
onChange?.(event);
}
Expand Down

0 comments on commit 56dcef4

Please sign in to comment.