Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
fix(Date): error message for min/max with date
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSharpieOne committed Dec 11, 2017
1 parent 15b4bff commit 6020830
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "availity-reactstrap-validation",
"version": "2.0.0-alpha.0",
"version": "2.0.0-alpha.1",
"author": "Evan Sharp <[email protected]>",
"description": "Form validation helpers for reactstrap",
"main": "lib/index.js",
Expand Down Expand Up @@ -61,7 +61,7 @@
"peerDependencies": {
"react": "^0.14.9 || ^15.3.0 || ^16.0.0",
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0",
"reactstrap": ">= 5.0.0-alpha.3"
"reactstrap": ">= 5.0.0-alpha.4"
},
"devDependencies": {
"babel-cli": "^6.10.1",
Expand Down Expand Up @@ -116,7 +116,7 @@
"react-router": "^2.0.1",
"react-test-renderer": "^15.5.4",
"react-transition-group": "^1.1.3",
"reactstrap": "^5.0.0-alpha.3",
"reactstrap": "^5.0.0-alpha.4",
"rimraf": "^2.5.4",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/AvValidator/max.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function validate(value, context, constraint = {}, input = {}) {

if ((input.validations && input.validations.date) ||
(input.props && input.props.type && input.props.type.toLowerCase() === 'date')) {
return moment(value, [isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrBefore(constraint.value, 'day');
return moment(value, [isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrBefore(constraint.value, 'day') || constraint.errorMessage || false;
}

const number = toNumber(value);
Expand Down
2 changes: 1 addition & 1 deletion src/AvValidator/min.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function validate(value, context, constraint = {}, input = {}) {

if ((input.validations && input.validations.date) ||
(input.props && input.props.type && input.props.type.toLowerCase() === 'date')) {
return moment(value, [isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrAfter(constraint.value, 'day');
return moment(value, [isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrAfter(constraint.value, 'day') || constraint.errorMessage || false;
}

const number = toNumber(value);
Expand Down

0 comments on commit 6020830

Please sign in to comment.