Skip to content

Commit

Permalink
feat: checking is in isoString format
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingcedru committed Dec 13, 2024
1 parent 7977fbf commit ee2eef2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/drec-api/src/pods/device/dto/new-device.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
IsIn,
IsDate,
MaxDate,
IsISO8601,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { OffTaker, FuelCode, DevicetypeCode } from '../../../utils/enums';
Expand Down Expand Up @@ -106,6 +107,9 @@ export class NewDeviceDTO
capacity: number;

@ApiProperty()
@IsISO8601({
message: `Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`,
})
@Transform((value, obj) => new Date(obj.commissioningDate))
@IsDate()
@MaxDate(new Date(), {
Expand Down

0 comments on commit ee2eef2

Please sign in to comment.