Skip to content

Commit

Permalink
store birthdayformat; update personData on change (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Gordon Grund <[email protected]>
  • Loading branch information
ggrund-tsi and ggrund-tsi authored Jun 15, 2021
1 parent 93f07e3 commit b7253d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/modules/form-group.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -140,7 +141,7 @@ export const PersonInputs = (props: any) => {
const [standardisedFamilyName, setStandardisedFamilyName] = React.useState<string>('');

const [dateOfBirth, setDateOfBirth] = React.useState<Date>();
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) {
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit b7253d1

Please sign in to comment.