This commit is contained in:
32
ayanova/src/api/gzaftervalidator.js
Normal file
32
ayanova/src/api/gzaftervalidator.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// import { isAfter, isEqual } from "date-fns";
|
||||||
|
// import { parseDate as parse } from "../utils/date";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
const gzAfterValidator = (value, { targetValue } = {}) => {
|
||||||
|
value = dayjs(value);
|
||||||
|
targetValue = dayjs(targetValue);
|
||||||
|
|
||||||
|
// if either is not valid.
|
||||||
|
if (!value || !targetValue) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/*eslint-disable */
|
||||||
|
debugger;
|
||||||
|
return value.isAfter(targetValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hasTarget: true,
|
||||||
|
isDate: true
|
||||||
|
};
|
||||||
|
|
||||||
|
// required to convert from a list of array values to an object.
|
||||||
|
const paramNames = ["targetValue"];
|
||||||
|
|
||||||
|
export { gzAfterValidator as validate, options, paramNames };
|
||||||
|
|
||||||
|
export default {
|
||||||
|
validate: gzAfterValidator,
|
||||||
|
options,
|
||||||
|
paramNames
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user