From b7253d1d13773e533ffe49992457f7791df3280c Mon Sep 17 00:00:00 2001 From: ggrund-tsi <80682839+ggrund-tsi@users.noreply.github.com> Date: Tue, 15 Jun 2021 11:45:17 +0200 Subject: [PATCH] store birthdayformat; update personData on change (#96) Co-authored-by: Gordon Grund --- src/components/modules/form-group.component.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/modules/form-group.component.tsx b/src/components/modules/form-group.component.tsx index 20cb488..7412260 100644 --- a/src/components/modules/form-group.component.tsx +++ b/src/components/modules/form-group.component.tsx @@ -9,6 +9,7 @@ import DatePicker from "react-datepicker"; // import { registerLocale } from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { IValueSet, useGetDateFormats } from "../../api"; +import useLocalStorage from "../../misc/local-storage"; const iso3311a2 = require('iso-3166-1-alpha-2'); @@ -140,7 +141,7 @@ export const PersonInputs = (props: any) => { const [standardisedFamilyName, setStandardisedFamilyName] = React.useState(''); const [dateOfBirth, setDateOfBirth] = React.useState(); - const [dateFormat, setDateFormat] = React.useState('yyyy-MM-dd'); + const [dateFormat, setDateFormat] = useLocalStorage('dateFormat', 'yyyy-MM-dd'); React.useEffect(() => { if (props && props.eudgc && props.eudgc.nam) { @@ -177,7 +178,7 @@ export const PersonInputs = (props: any) => { props.onChange(result); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [givenName, familyName, standardisedGivenName, standardisedFamilyName, dateOfBirth]) + }, [givenName, familyName, standardisedGivenName, standardisedFamilyName, dateOfBirth, dateFormat]) const handleStandardisedNameChanged = (changedValue: string, setStandardisedName: (value: string) => void) => {