What are people using Nexus/Prisma doing for datet...
# orm-help
m
What are people using Nexus/Prisma doing for datetime/timestamp fields in their db. For some reason, Nexus doesn't have them as a scalar type. Do you pull them as strings and then use Moment or some other method to deal with them? Do you create your own scalar type? I don't see any examples of datetime fields in the usual documenation.
r
Hey @Matt 👋 My personal method would be creating a scalar type. You can follow this example from the Nexus docs as to how to create a custom scalar.
👍 1
m
Thanks Ryan, that is the create page I'd found but wasn't sure if was still the best way to do it. I do have a follow up question: I haven't found anything yet on how to use a datetime as an arg. Is there documentation somewhere on how I would implement a
dateArg
for that purpose?
@Ryan Sorry to ping you directly but I wanted to keep this thread intact. I've got the scalar type working now (thank you!) but I'm still wondering about whether there's a way to make a
dateTimeArg
so I can use it in a findMany query or in a mutation. Is this something that can be made or do I just need to use momentjs and strings and manipulate my code accordingly?
r
Hey @Matt 👋 Did you try creating an input and passing the DateTime scalar as a type in that? If you pass it a string, it will automatically be converted to the Date object