P
Prisma4mo ago
sommeeer

Get the next date with prisma

const course = await db.course.findFirst({
where: {
slug: params.slug,
},
include: {
courseDate: { // i want the next one from NOW
orderBy: {
from: 'asc',
}
},
},
});
const course = await db.course.findFirst({
where: {
slug: params.slug,
},
include: {
courseDate: { // i want the next one from NOW
orderBy: {
from: 'asc',
}
},
},
});
guys i want to get next courseDate from today and only that one. how can i do that using this query? 🙂
6 Replies
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
sommeeer
sommeeer4mo ago
ok. any particular reason to use .toUTCString()?
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
sommeeer
sommeeer4mo ago
i do, but isnt new Date() enough? under the hood its just a timestamp since epoch
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
sommeeer
sommeeer4mo ago
alright:) thanks!