mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 19:47:03 -04:00
fix: ensure dates are properly transformed
To correctly transform Date objects from ISO-strings in JSON to instances, class-transformer requires the `@Type` annotation. References: https://github.com/typestack/class-transformer#%D1%81onverting-date-strings-into-date-objects Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
59a235ebc4
commit
7e8716ec95
8 changed files with 23 additions and 1 deletions
|
@ -14,7 +14,6 @@ import {
|
|||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
|
||||
import { UserInfoDto } from '../users/user-info.dto';
|
||||
import { BaseDto } from '../utils/base.dto.';
|
||||
import { NotePermissionsDto } from './note-permissions.dto';
|
||||
|
||||
|
@ -73,6 +72,7 @@ export class NoteMetadataDto extends BaseDto {
|
|||
* @example "2020-12-01 12:23:34"
|
||||
*/
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@ApiProperty()
|
||||
updatedAt: Date;
|
||||
|
||||
|
@ -97,6 +97,7 @@ export class NoteMetadataDto extends BaseDto {
|
|||
* @example "2020-12-01 12:23:34"
|
||||
*/
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@ApiProperty()
|
||||
createdAt: Date;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue