Skip to content

Commit 5a54828

Browse files
Restrict valid dates for both exception types to format MM/DD/YYYY (#396)
Co-authored-by: Chandra Y <[email protected]>
1 parent 7118451 commit 5a54828

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apcd_cms/src/client/src/components/Submitter/Exceptions/ExceptionFormPage.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ export const ExceptionFormPage: React.FC = () => {
6060
.required('Business name is required'),
6161
fileType: Yup.string().required('File type is required'),
6262
fieldCode: Yup.string().required('Field code is required'),
63-
expiration_date: Yup.date().required('Expiration date is required'),
63+
expiration_date: Yup.date().required('Expiration date is required')
64+
.max('9999-12-31', 'Expiration date must be MM/DD/YYYY')
65+
.min('0001-01-01', 'Expiration date must be MM/DD/YYYY'),
6466
requested_threshold: Yup.number().required(
6567
'Requested threshold is required'
6668
),
@@ -79,7 +81,9 @@ export const ExceptionFormPage: React.FC = () => {
7981
}),
8082
expirationDateOther: Yup.mixed().when('exceptionType', {
8183
is: 'other',
82-
then: (schema) => Yup.date().required('Required'),
84+
then: (schema) => Yup.date().required('Required')
85+
.max('9999-12-31', 'Date must be MM/DD/YYYY')
86+
.min('0001-01-01', 'Date must be MM/DD/YYYY'),
8387
otherwise: (schema) => schema.strip(),
8488
}),
8589
otherExceptionBusinessName: Yup.mixed().when('exceptionType', {

0 commit comments

Comments
 (0)