【Prisma】Where in the date period.

The Date Period Filter with Prisma is very simple.

目次

Filter by date period

Search above and below by specific date here.

const result = await prisma.post.findMany({
  where: {
    date_created: {
      gte: new Date(
        '2020-03-19T00:00:00+0200'
      ),
      lte: new Date(
        '2020-03-20T00:00:00+0200'
      )
    },
  },
})

Translated as gt = greater than, lt = less than.

Translated as gte = greater than or equal to, lte = less than or equal to.

Filter conditions

The following is a summary of the most commonly used conditions for date filters.

スクロールできます
Operator Filter
lenより小さい
lten以下
gtnより大きい
gten以上
equalsnと等しい
Filter conditions and operators
シェア!

この記事を書いた人

kenichiのアバター kenichi エンジニア・写真家 | Engineer and photographer

Nomadic worker who travels all over Japan and abroad; worked as a technical sales person for five years before going independent.
Works as a freelance engineer on website production and application development. Currently working to bring interesting things by interesting people to the world, while seeking to move abroad.

目次