0

i am trying to add an Date type to my prisma2 schema. I know there is a DateTime type but I am just needing the date. Because I haven't found anything related to Date I would add an Custom input with day, month and year and create then a Date with the time 12:00 (so I have not so much problems with timezones) or a timestamp. I hope you have some better ideas or best practices. best regards and thanks!

user2675468
  • 150
  • 3
  • 16

1 Answers1

0

create custom date scalar type with nexus. if you're using graphql you need to create a custom scalar like this.

const CustomTime = scalarType({
  name: 'CustomTime',
  description: 'Consider time as 12 hour time.',
  asNexusMethod: 'customTime',
  parseValue(value) {
    return moment(value, '').format('')
  }
})
Harsh Makwana
  • 237
  • 3
  • 13