diff --git a/actions/editProfile.ts b/actions/editProfile.ts index 39ab68409..010772c4a 100644 --- a/actions/editProfile.ts +++ b/actions/editProfile.ts @@ -120,6 +120,15 @@ export const editProfile = protectedServerActionProcedure return } + // Handle case where dateOfBirth is missing in profile and not updated in form + if ( + typedKey === "dateOfBirth" && + !profile.dateOfBirth && + payload.data.dateOfBirth === "1900-01-01" + ) { + return + } + if (payload.data[typedKey] !== profile[typedKey]) { // @ts-ignore body[typedKey] = payload.data[typedKey] diff --git a/components/Forms/Edit/Profile/index.tsx b/components/Forms/Edit/Profile/index.tsx index 6a4593d74..1b40b80f1 100644 --- a/components/Forms/Edit/Profile/index.tsx +++ b/components/Forms/Edit/Profile/index.tsx @@ -60,7 +60,7 @@ export default function Form({ user }: EditFormProps) { streetAddress: user.address.streetAddress ?? "", zipCode: user.address.zipCode ?? "", }, - dateOfBirth: user.dateOfBirth, + dateOfBirth: user.dateOfBirth ?? "1900-01-01", email: user.email, language: user.language ?? langToApiLang[lang], phoneNumber: phoneInput,