Compare commits
1 Commits
50fba1a909
...
fca79c36ef
Author | SHA1 | Date |
---|---|---|
Ferdinand Thiessen | fca79c36ef |
|
@ -62,8 +62,8 @@ export default defineComponent({
|
|||
setup(props, { emit, attrs }) {
|
||||
const customRules = computed(() => [
|
||||
props.type == 'date' ? stringIsDate : props.type == 'time' ? stringIsTime : stringIsDateTime,
|
||||
(value?: string | null) => {
|
||||
if (props.rules.length > 0 && value) {
|
||||
(value?: string) => {
|
||||
if (props.rules.length > 0 && !!value) {
|
||||
let date: Date | undefined = undefined;
|
||||
if (props.type == 'date') date = modifyDate(value);
|
||||
else if (props.type == 'time') date = modifyTime(value);
|
||||
|
@ -71,10 +71,11 @@ export default defineComponent({
|
|||
const split = value.split(' ');
|
||||
date = modifyTime(split[1], modifyDate(split[0]));
|
||||
}
|
||||
props.rules.forEach((rule) => {
|
||||
for (const rule of props.rules) {
|
||||
const r = rule(date);
|
||||
if (typeof r === 'string') return r;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue