Answer the question
In order to leave comments, you need to log in
What can prevent the class-transformer from converting the date?
This is how the form field looks like:
This is how the field looks like in the model:
import {Transform, Type} from 'class-transformer';
@Type(() => Date)
@Transform(value => value ? moment(value).format('YYYY-MM-DD') : value, { toPlainOnly: true })
@Transform(value => value ? moment(value) : value, { toClassOnly: true })
date_of_create: any;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question