Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Transform not working with "reflect-metadata@0.2.2" #1783

Open
andrazperson opened this issue Nov 10, 2024 · 0 comments
Open

fix: Transform not working with "reflect-metadata@0.2.2" #1783

andrazperson opened this issue Nov 10, 2024 · 0 comments
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.

Comments

@andrazperson
Copy link

Description

When updating the "reflect-metadata" package from 0.2.1 to 0.2.2, the value transformation defined in @Transform decorator does not execute.

This is a class I have defined in the code, which works with the previous version of "reflect-metadata".

import { Transform } from "class-transformer";
import moment from "moment-timezone";

export class Event {
  id!: string;
  visible!: boolean;

  @Transform(({ value }: { value: string }) => moment.parseZone(value).toDate())
  start!: Date;

  @Transform(({ value }: { value: string }) => moment.parseZone(value).toDate())
  end!: Date;
}

Expected behavior

Event.start and Event.end should be of type Date, with the parsed timezone.

Actual behavior

Event.start and Event.end are not transformed string types.

@andrazperson andrazperson added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Nov 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.
Development

No branches or pull requests

1 participant