Prisma-client-js: DateTime not converted to Date when using `where`

Created on 24 Oct 2019  路  1Comment  路  Source: prisma/prisma-client-js

Prisma2 preview 15 introduced mapping of DateTime to JS Date:

  console.log(result1[0].posts);
  const result2 = await photon.users.findMany({
    select: {
      id: true,
      posts: { last: 1 },
    },
  });
  console.log(result2[0].posts);

image

But when using the where option in find, I receive the date as a string which breaks my API:

  const result1 = await photon.users.findMany({
    where: {
      id: { in: ["ck24ojnxx000360da79ze73gb", "ck24ojnxl000060damtkztmqs"] },
    },
    select: {
      id: true,
      posts: { last: 1 },
    },
  });
  console.log(result1[0].posts);

image

bu2-confirmed

Most helpful comment

Fixed in latest alpha.
You can try it out with npm i -g prisma2@alpha.

>All comments

Fixed in latest alpha.
You can try it out with npm i -g prisma2@alpha.

Was this page helpful?
0 / 5 - 0 ratings