From e58a3ecb43c49c4b5a5d446193eb490a0f079c3d Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Tue, 17 Feb 2026 19:17:44 +0100 Subject: [PATCH] Fix age selection logic to ensure min is not greater than max --- web/components/optional-profile-form.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/components/optional-profile-form.tsx b/web/components/optional-profile-form.tsx index 41e57e2..0292d2e 100644 --- a/web/components/optional-profile-form.tsx +++ b/web/components/optional-profile-form.tsx @@ -415,9 +415,11 @@ export const OptionalProfileUserForm = (props: { {t('common.min', 'Min')} - setProfile('pref_age_max', e.target.value ? Number(e.target.value) : 100) - } + onChange={(e) => { + const newMax = e.target.value ? Number(e.target.value) : 100 + const currentMin = profile['pref_age_min'] ?? 18 + setProfile('pref_age_max', Math.max(newMax, currentMin)) + }} className={'w-18 border-ink-300 rounded-md'} >