Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

DateTime not converted to Date when using where #267

Closed
MichalLytek opened this issue Oct 24, 2019 · 1 comment
Closed

DateTime not converted to Date when using where #267

MichalLytek opened this issue Oct 24, 2019 · 1 comment
Assignees
Labels
bug/2-confirmed We have confirmed that this is a bug.
Milestone

Comments

@MichalLytek
Copy link

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

@timsuchanek timsuchanek added the bug/2-confirmed We have confirmed that this is a bug. label Oct 25, 2019
@timsuchanek timsuchanek self-assigned this Oct 25, 2019
@timsuchanek
Copy link
Contributor

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

@janpio janpio removed the process/candidate Candidate for next Milestone. label Oct 28, 2019
@janpio janpio added this to the Preview 16 milestone Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants