A. Sauder
02/25/2022, 3:47 PMNurul
02/28/2022, 2:41 PMlt/lte/gt/gte
Here is an example of comparing dates,
Considering this Project model
model Project {
id Int @id @default(autoincrement())
title String
userId Int
dueDate DateTime?
completedDate DateTime?
createdAt DateTime? @default(now())
}
You could compare dates like this
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
await prisma.project.findMany({
where: {
completedDate: {
lt: Date.now()
}
}
})
A. Sauder
03/01/2022, 1:55 AMmodel StageItem {
id String @id @default(uuid())
start_at DateTime
duration Int
}
And now i want select all records, where the start_at + duration is bigger then a given date.