From 264830c40e90bf898dbc91784fe337b525fe5901 Mon Sep 17 00:00:00 2001 From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com> Date: Thu, 13 Jan 2022 14:47:20 +0000 Subject: [PATCH] fix(profileType): init correctly the date selection in profile type form --- .../ProfileType/ProfileTypeFormDateSelection.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/ProfileType/ProfileTypeFormDateSelection.tsx b/src/components/ProfileType/ProfileTypeFormDateSelection.tsx index 356be9445..268a7f363 100644 --- a/src/components/ProfileType/ProfileTypeFormDateSelection.tsx +++ b/src/components/ProfileType/ProfileTypeFormDateSelection.tsx @@ -25,8 +25,8 @@ interface ProfileTypeFormDateSelectionProps { } interface SelectionMonth { - label: string - value: number + label: string | null + value: string } const ProfileTypeFormDateSelection: React.FC<ProfileTypeFormDateSelectionProps> = ({ @@ -41,12 +41,14 @@ const ProfileTypeFormDateSelection: React.FC<ProfileTypeFormDateSelectionProps> const { t } = useI18n() const [selectedMonth, setSelectedMonth] = useState<any>({ label: DateTime.now().toLocaleString({ month: 'long' }), - value: DateTime.now().month, // Date.getMonth starts at 0 + value: DateTime.now() + .month.toString() + .padStart(2, '0'), // Date.getMonth starts at 0 }) const [selectedYear, setSelectedYear] = useState<number>(DateTime.now().year) const [answer, setAnswer] = useState<ProfileTypeAnswerChoices>('') - const selectMonths = [ + const selectMonths: SelectionMonth[] = [ { label: 'Janvier', value: '01', -- GitLab