Disabling luxon for date columns #4627
Answered
by
RomainLanz
maximelebastard
asked this question in
Help
-
Hi, I'm trying to use Adonis/Lucid with AdminJS and the adonis adapter. Unfortunately, AdminJS provides and consumes native JS Date columns when dealing with datetime inputs, which triggers type errors. As Luxon is not useful in my case, the easiest would be to stop using it in my models - it would be ok for me to work with JS Dates as I always did. Is there a simple way to do that ? |
Beta Was this translation helpful? Give feedback.
Answered by
RomainLanz
Jun 25, 2024
Replies: 1 comment 2 replies
-
Hey @maximelebastard! 👋🏻 If you don't use the class User extends BaseModel {
@column()
createdAt: string
@column({
consume: (v: string) => new Date(v),
prepare: (v: Date) => v.toISOString(),
)
updatedAt: Date
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
maximelebastard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @maximelebastard! 👋🏻
If you don't use the
@column.dateTime()
decorator you will be fine.