WIP Изменила инпут, сделала документы

This commit is contained in:
Daria Golova
2023-08-22 15:19:28 +03:00
parent 817f881159
commit 4987a3ae09
6 changed files with 146 additions and 169 deletions

View File

@@ -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;
}