Skip to content

Commit

Permalink
fix(useDateField): drop manual date instance
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavPetrik committed Mar 14, 2024
1 parent ae8ee11 commit c2d6460
Show file tree
Hide file tree
Showing 3 changed files with 330 additions and 90 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
"ui": "yarn upgrade-interactive"
},
"devDependencies": {
"@emotion/react": "^11.11.3",
"@form-atoms/list-atom": "^1.0.5",
"@emotion/react": "^11.11.4",
"@form-atoms/list-atom": "^1.0.11",
"@picocss/pico": "^2.0.6",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^11.1.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6",
"@semantic-release/npm": "^11.0.2",
"@semantic-release/npm": "^11.0.3",
"@semantic-release/release-notes-generator": "^12.1.0",
"@storybook/addon-actions": "^8.0.0",
"@storybook/addon-docs": "^8.0.0",
Expand All @@ -76,8 +76,8 @@
"@types/react-copy-to-clipboard": "^5",
"@types/react-dom": "^18",
"@types/semantic-release": "^20.0.6",
"@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.3.1",
"eslint": "8.57.0",
Expand All @@ -86,7 +86,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "5.1.3",
"form-atoms": "^3.2.4",
"happy-dom": "^13.6.2",
"happy-dom": "^13.8.4",
"jotai": "2.7.0",
"jotai-devtools": "0.8.0",
"jotai-effect": "0.6.0",
Expand All @@ -99,7 +99,7 @@
"shiki": "^1.1.7",
"storybook": "^8.0.0",
"typescript": "5.3.3",
"vite": "^5.1.4",
"vite": "^5.1.6",
"vitest": "^1.3.1",
"zod": "3.22.4"
},
Expand Down
5 changes: 1 addition & 4 deletions src/hooks/use-date-field-props/useDateFieldProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ const getDate = (event: ChangeEvent<HTMLInputElement>) => {
const { valueAsDate } = event.currentTarget;

// empty input "" is read as null, so we normalize to undefined
return valueAsDate
? // valueAsDate instanceof Date does not work in test, so we instantiate it explicitly to make it work
new Date(event.currentTarget.valueAsNumber)
: undefined;
return valueAsDate ?? undefined;
};

export const useDateFieldProps = (
Expand Down
Loading

0 comments on commit c2d6460

Please sign in to comment.