Skip to content

Commit

Permalink
Restrict valid dates for both exception types to format MM/DD/YYYY (#396
Browse files Browse the repository at this point in the history
)

Co-authored-by: Chandra Y <[email protected]>
  • Loading branch information
edmondsgarrett and chandra-tacc authored Dec 10, 2024
1 parent 7118451 commit 5a54828
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export const ExceptionFormPage: React.FC = () => {
.required('Business name is required'),
fileType: Yup.string().required('File type is required'),
fieldCode: Yup.string().required('Field code is required'),
expiration_date: Yup.date().required('Expiration date is required'),
expiration_date: Yup.date().required('Expiration date is required')
.max('9999-12-31', 'Expiration date must be MM/DD/YYYY')
.min('0001-01-01', 'Expiration date must be MM/DD/YYYY'),
requested_threshold: Yup.number().required(
'Requested threshold is required'
),
Expand All @@ -79,7 +81,9 @@ export const ExceptionFormPage: React.FC = () => {
}),
expirationDateOther: Yup.mixed().when('exceptionType', {
is: 'other',
then: (schema) => Yup.date().required('Required'),
then: (schema) => Yup.date().required('Required')
.max('9999-12-31', 'Date must be MM/DD/YYYY')
.min('0001-01-01', 'Date must be MM/DD/YYYY'),
otherwise: (schema) => schema.strip(),
}),
otherExceptionBusinessName: Yup.mixed().when('exceptionType', {
Expand Down

0 comments on commit 5a54828

Please sign in to comment.