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 * * *",
|
||||
runOnInit: true,
|
||||
onTick: async () => {
|
||||
const current = new Date();
|
||||
|
||||
const date = current.getDate();
|
||||
const month = current.getMonth();
|
||||
const year = current.getFullYear();
|
||||
|
||||
await prisma.quotation
|
||||
.updateMany({
|
||||
where: {
|
||||
quotationStatus: "Issued",
|
||||
dueDate: { lte: new Date() },
|
||||
dueDate: { lte: new Date(year, date - 1 === 0 ? month - 1 : month, date - 1) },
|
||||
},
|
||||
data: { quotationStatus: "Expired" },
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue