diff options
Diffstat (limited to 'src/view/com/auth/create/Step2.tsx')
-rw-r--r-- | src/view/com/auth/create/Step2.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 89fd070ad..123b5f662 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -13,6 +13,17 @@ import {isWeb} from 'platform/detection' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useModalControls} from '#/state/modals' +import {logger} from '#/logger' + +function sanitizeDate(date: Date): Date { + if (!date || date.toString() === 'Invalid Date') { + logger.error(`Create account: handled invalid date for birthDate`, { + hasDate: !!date, + }) + return new Date() + } + return date +} /** STEP 2: Your account * @field Invite code or waitlist @@ -38,6 +49,10 @@ export function Step2({ openModal({name: 'waitlist'}) }, [openModal]) + const birthDate = React.useMemo(() => { + return sanitizeDate(uiState.birthDate) + }, [uiState.birthDate]) + return ( <View> <StepHeader step="2" title={_(msg`Your account`)} /> @@ -122,8 +137,9 @@ export function Step2({ <Trans>Your birth date</Trans> </Text> <DateInput + handleAsUTC testID="birthdayInput" - value={uiState.birthDate} + value={birthDate} onChange={value => uiDispatch({type: 'set-birth-date', value})} buttonType="default-light" buttonStyle={[pal.border, styles.dateInputButton]} |