diff --git a/src/components/Main/Scenario/ScenarioCardEpidemiological.tsx b/src/components/Main/Scenario/ScenarioCardEpidemiological.tsx index aca3b2f75..fe7f407e8 100644 --- a/src/components/Main/Scenario/ScenarioCardEpidemiological.tsx +++ b/src/components/Main/Scenario/ScenarioCardEpidemiological.tsx @@ -47,7 +47,7 @@ function ScenarioCardEpidemiological({ errors, touched }: ScenarioCardEpidemiolo label={`${t('Latency')} [${t('days')}]`} help={t('Time from infection to onset of symptoms (here onset of infectiousness)')} step={0.1} - min={0} + min={1} errors={errors} touched={touched} /> @@ -58,7 +58,7 @@ function ScenarioCardEpidemiological({ errors, touched }: ScenarioCardEpidemiolo 'Average number of days a person is infectious. Over this time, R0 infections happen on average. Together with the latency time, this defines the serial interval. The longer the serial interval, the slower the outbreak.', )} step={0.1} - min={0} + min={1} errors={errors} touched={touched} /> @@ -84,7 +84,7 @@ function ScenarioCardEpidemiological({ errors, touched }: ScenarioCardEpidemiolo label={`${t('Hospital stay')} [${t('days')}]`} help={t('Average number of days a severe case stays in regular hospital beds')} step={0.1} - min={0} + min={1} errors={errors} touched={touched} /> @@ -93,7 +93,7 @@ function ScenarioCardEpidemiological({ errors, touched }: ScenarioCardEpidemiolo label={`${t('ICU stay')} [${t('days')}]`} help={t('Average number of days a critical case stays in the ICU')} step={0.1} - min={0} + min={1} errors={errors} touched={touched} /> diff --git a/src/components/Main/validation/schema.ts b/src/components/Main/validation/schema.ts index c613b2d71..7846da152 100644 --- a/src/components/Main/validation/schema.ts +++ b/src/components/Main/validation/schema.ts @@ -10,6 +10,7 @@ const ageRegions = [...ageDistributionNames, CUSTOM_COUNTRY_NAME] const MSG_REQUIRED = i18next.t('Value is required') const MSG_NON_NEGATIVE = i18next.t('Should be non-negative (or zero)') const MSG_POSITIVE = i18next.t('Should be strictly positive (non-zero)') +const MSG_AT_LEAST_ONE_DAY = i18next.t('Should be at least one day or greater') export function dateRange() { return yup.object({ @@ -38,13 +39,13 @@ export const schema = yup.object().shape({ epidemiological: yup.object().shape({ r0: yup.number().required(MSG_REQUIRED).min(0, MSG_NON_NEGATIVE), - latencyTime: yup.number().required(MSG_REQUIRED).positive(MSG_POSITIVE), + latencyTime: yup.number().required(MSG_REQUIRED).min(1, MSG_AT_LEAST_ONE_DAY), - infectiousPeriod: yup.number().required(MSG_REQUIRED).positive(MSG_POSITIVE), + infectiousPeriod: yup.number().required(MSG_REQUIRED).min(1, MSG_AT_LEAST_ONE_DAY), - lengthHospitalStay: yup.number().required(MSG_REQUIRED).positive(MSG_POSITIVE), + lengthHospitalStay: yup.number().required(MSG_REQUIRED).min(1, MSG_AT_LEAST_ONE_DAY), - lengthICUStay: yup.number().required(MSG_REQUIRED).positive(MSG_POSITIVE), + lengthICUStay: yup.number().required(MSG_REQUIRED).min(1, MSG_AT_LEAST_ONE_DAY), seasonalForcing: yup.number().required(MSG_REQUIRED).min(0, MSG_NON_NEGATIVE),