Skip to content

Commit

Permalink
fix(common): CHECKOUT-4336 Fix optional date validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Sanchez committed Nov 6, 2019
1 parent 651c8c8 commit 8b928a8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 27 deletions.
77 changes: 54 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/googlemaps": "^3.30.16",
"@types/lodash": "^4.14.136",
"@types/react": "^16.8.0",
"@types/react-datepicker": "^2.3.0",
"@types/react-datepicker": "^2.9.3",
"@types/react-dom": "^16.8.5",
"@types/react-modal": "^3.8.0",
"@types/react-transition-group": "^2.0.15",
Expand All @@ -51,13 +51,13 @@
"credit-card-type": "^8.0.0",
"dompurify": "^1.0.8",
"downshift": "^3.2.10",
"formik": "^1.5.0",
"formik": "^1.5.8",
"local-storage-fallback": "^4.1.1",
"lodash": "^4.17.15",
"object-hash": "^1.3.0",
"prop-types": "^15.6.2",
"react": "^16.8.0",
"react-datepicker": "^2.7.0",
"react-datepicker": "^2.9.6",
"react-dom": "^16.8.0",
"react-media": "^1.10.0",
"react-modal": "^3.8.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app/address/getAddressValidationSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default memoize(function getAddressValidationSchema({
// validation when it's optional
.strict(true)
.nullable(true)
.transform(value => value === '' ? null : value);
.transform((value, originalValue) => originalValue === '' ? null : value);
} else if (type === 'integer') {
schema[name] = number()
// Transform NaN values to undefined to avoid empty string (empty input) to fail number
Expand Down

0 comments on commit 8b928a8

Please sign in to comment.