fix: time got ignored
This commit is contained in:
parent
be14c7d87a
commit
fc460eceea
1 changed files with 7 additions and 1 deletions
|
|
@ -7,11 +7,17 @@ const jobs = [
|
||||||
cronTime: "0 0 0 * * *",
|
cronTime: "0 0 0 * * *",
|
||||||
runOnInit: true,
|
runOnInit: true,
|
||||||
onTick: async () => {
|
onTick: async () => {
|
||||||
|
const current = new Date();
|
||||||
|
|
||||||
|
const date = current.getDate();
|
||||||
|
const month = current.getMonth();
|
||||||
|
const year = current.getFullYear();
|
||||||
|
|
||||||
await prisma.quotation
|
await prisma.quotation
|
||||||
.updateMany({
|
.updateMany({
|
||||||
where: {
|
where: {
|
||||||
quotationStatus: "Issued",
|
quotationStatus: "Issued",
|
||||||
dueDate: { lte: new Date() },
|
dueDate: { lte: new Date(year, date - 1 === 0 ? month - 1 : month, date - 1) },
|
||||||
},
|
},
|
||||||
data: { quotationStatus: "Expired" },
|
data: { quotationStatus: "Expired" },
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue