Skip to content

Commit

Permalink
fix: [Contracts] Fix date check on create contract DTO
Browse files Browse the repository at this point in the history
  • Loading branch information
radulescuandrew committed Sep 20, 2024
1 parent 42a397e commit 76dd232
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions backend/src/api/documents/dto/create-document-contract.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ export class CreateDocumentContractDto {
documentNumber: string;

@IsDate()
@MinDate(() => new Date(), {
message: 'Document date must be greater than or equal to the current date',
})
@MinDate(
() => {
const today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate());
},
{
message:
'Document date must be greater than or equal to the current date',
},
)
documentDate: Date;

@IsDate()
Expand Down

0 comments on commit 76dd232

Please sign in to comment.