mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-30 11:18:36 +08:00
refactor: linkage rules support datetime (#2260)
* refactor: linkage rules support datetime * refactor: linkage rules support datetime
This commit is contained in:
parent
aececf1952
commit
62381e5953
@ -150,6 +150,55 @@ http://ricostacruz.com/cheatsheets/umdjs.html
|
||||
}
|
||||
return false;
|
||||
},
|
||||
$dateOn: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
const milliseconds1 = new Date(a).getTime();
|
||||
const milliseconds2 = new Date(b).getTime();
|
||||
return milliseconds1 === milliseconds2;
|
||||
},
|
||||
$dateBefore: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Date(a) < new Date(b);
|
||||
},
|
||||
$dateNotBefore: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Date(a) <= new Date(b);
|
||||
},
|
||||
$dateAfter: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Date(a) > new Date(b);
|
||||
},
|
||||
$dateNotAfter: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
return new Date(a) >= new Date(b);
|
||||
},
|
||||
$dateBetween: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
const startTime = new Date(b?.[0]);
|
||||
const endTime = new Date(b?.[1]);
|
||||
return new Date(a) > startTime && new Date(a) < endTime;
|
||||
},
|
||||
$dateNotOn: function (a, b) {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
return new Date(a) != new Date(b);
|
||||
},
|
||||
$isTruly: function (a) {
|
||||
if (Array.isArray(a)) return a.some((k) => k === true || k === 1);
|
||||
return a === true || a === 1;
|
||||
|
Loading…
Reference in New Issue
Block a user