diff --git a/src/components/Patient/PatientRegistration.tsx b/src/components/Patient/PatientRegistration.tsx index 2cfade10b39..460e7cab18f 100644 --- a/src/components/Patient/PatientRegistration.tsx +++ b/src/components/Patient/PatientRegistration.tsx @@ -492,13 +492,20 @@ export default function PatientRegistration( maxLength={2} max={31} min={1} - data-cy="dob-day-input" - onChange={(e) => + onChange={(e) => { setForm((f) => ({ ...f, date_of_birth: `${form.date_of_birth?.split("-")[0] || ""}-${form.date_of_birth?.split("-")[1] || ""}-${e.target.value}`, - })) - } + })); + const day = parseInt(e.target.value); + if ( + e.target.value.length === 2 && + day >= 1 && + day <= 31 + ) { + document.getElementById("month-input")?.focus(); + } + }} />