WIP Изменила инпут, сделала документы
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as moment from "moment/moment";
|
||||
|
||||
export function ruleNotValue(val, text) {
|
||||
return !!val || text || false;
|
||||
}
|
||||
@@ -21,12 +22,16 @@ export function ruleMaxLength(val, maxLength, text) {
|
||||
}
|
||||
|
||||
export function ruleDateValue(val, text) {
|
||||
let date = moment(
|
||||
val && val?.length === 10 ? val.split(".").reverse().join("-") : null
|
||||
);
|
||||
return (
|
||||
(val && !moment(val).isAfter(moment().format("YYYY-MM-DD"))) ||
|
||||
(date.isValid() && !date.isAfter(moment().format("YYYY-MM-DD"))) ||
|
||||
text ||
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
export function ruleNumberInput(val, max, min, text) {
|
||||
return (val <= max && val >= min) || text || false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user