Skip to content

v2.2.1

Compare
Choose a tag to compare
@jhaemin jhaemin released this 21 Jun 10:42
· 138 commits to master since this release

Time.getPrismaCurrent()

Returns the current time for using with Prisma.

const currentTime = Time.getPrismaCurrent()

await prisma.tip.create({
  data: {
    user: {
      connect: {
        id: userId,
      },
    },
    title,
    topic,
    body,
    randomNickname: randomNick,
    createdAt: currentTime,
    editedAt: currentTime,
  },
})

⚠️ Time.getIsoString() is deprecated

prismaTimeMod()

We assume that prisma treats the time in database as UTC time. Wrapping the result of Prisma client with this function resolves the issue by merely subtracting 9 hours from the UTC time (UTC+9:00 is KST).

First argument could be any variable which includes Date.