0

I'm trying parse ISo8601String to Date in Nest JS through DTO. I send a json with the date's string like:

{lunMIni: 1001-01-01 00:00:00.000}

In Nest js, I receive the data and it's transform by:

 @ApiProperty()  
 @Type(() => Date)
 @IsDate()
 lunMIni: Date

After transform, the data is:

 {lunMIni: 1001-01-01T00:14:44.000Z}

I don't know why the date change to 00:14:44 ?

Jose David
  • 39
  • 9
  • If you are passing UTC time in your dto, you need to have suffix Z [read this](https://en.wikipedia.org/wiki/ISO_8601#Times). Z stands for the Zero offset from the Coordinated Universal Time (UTC). When you pass time without suffix Z, class transformer assumes the date in dto is in local timezone. – username_jj Jul 20 '22 at 08:52

0 Answers0