Skip to content

DateTime doesn't support ISO string with offset #9516

@paulrostorp

Description

@paulrostorp

Bug description

When passing ISO8601 strings with offset information, prisma throws an error.

How to reproduce

With a Prisma schema:

model Task {
  startDate: DateTime @db.Timestampz
}

A Zulu ISO8601 string works:

prisma.task.create({
  data: {
    startDate: "2021-09-28T22:00Z"
  }
})

A ISO8601 string doesn't

prisma.task.create({
  data: {
    startDate: "2021-09-29T00:00+02:00"
  }
})

with the error:

Error: Argument startDate: Got invalid value '2021-09-29T00:00+02:00' on prisma.createTask. Provided String, expected DateTime or Null.

Expected behavior

No response

Prisma information

model Task {
  startDate: DateTime @db.Timestampz
}

Environment & setup

  • OS: mac os , m1 chip
  • Database: PostgreSQL v13
  • Node.js version: node 16

Prisma Version

v2.30.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions