import { Transform } from 'class-transformer';
import moment from 'moment';

export function TransformDate(): PropertyDecorator {
  return Transform(({ value }) => {
    if (!value) return undefined;

    return moment(value).utc().startOf('day').toDate();
  });
}
