How can I get typeorm to work with js-joda

350 views Asked by At
export class ZonedDateTimeTransformer implements ValueTransformer {
  to(value: ZonedDateTime): Date {
    return convert(value).toDate();
  }
  from(value: Date): ZonedDateTime {
    return ZonedDateTime.from(nativeJs(value));
  }
}

  @Column({
    name: 'date_joined',
    type: 'timestamp with time zone',
    transformer: new ZonedDateTimeTransformer(),
  })
  readonly dateJoined!: ZonedDateTime;

I've tried a few permutations of the transformer, it doesn't even seem to be getting called, I'm getting a stackoverflow in orm https://github.com/typeorm/typeorm/issues/6181

is there a way to make typeorm to play with the js-joda types?

0

There are 0 answers