diff --git a/src/screens/UserPortal/Settings/Settings.spec.tsx b/src/screens/UserPortal/Settings/Settings.spec.tsx index f04902c5ad..184789ab04 100644 --- a/src/screens/UserPortal/Settings/Settings.spec.tsx +++ b/src/screens/UserPortal/Settings/Settings.spec.tsx @@ -430,12 +430,14 @@ it('prevents selecting future dates for birth date', async () => { 'Birth Date', ) as HTMLInputElement; const today = new Date().toISOString().split('T')[0]; + const futureDate = new Date(); + futureDate.setFullYear(futureDate.getFullYear() + 100); + const futureDateString = futureDate.toISOString().split('T')[0]; // Trying future date - fireEvent.change(birthDateInput, { target: { value: '2100-01-01' } }); - + fireEvent.change(birthDateInput, { target: { value: futureDateString } }); // Checking if value is not updated to future date - expect(birthDateInput.value).not.toBe('2100-01-01'); + expect(birthDateInput.value).not.toBe(futureDateString); // Checking if value set correctly fireEvent.change(birthDateInput, { target: { value: today } });