Skip to content

Commit

Permalink
fix: [Contracts] Fix wrong date comparisson
Browse files Browse the repository at this point in the history
  • Loading branch information
radulescuandrew committed Sep 23, 2024
1 parent d5914f3 commit 9308e0d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable } from '@nestjs/common';
import { isSameYear } from 'date-fns';
import { isOver16FromCNP } from 'src/common/helpers/utils';
import { IUseCaseService } from 'src/common/interfaces/use-case-service.interface';
import { ExceptionsService } from 'src/infrastructure/exceptions/exceptions.service';
Expand Down Expand Up @@ -84,8 +85,7 @@ export class CreateDocumentContractUsecase implements IUseCaseService<string> {

if (
existingContract &&
existingContract.documentDate.getFullYear() ===
newContract.documentDate.getFullYear()
isSameYear(existingContract.documentDate, newContract.documentDate)
) {
this.exceptionsService.badRequestException(
ContractExceptionMessages.CONTRACT_004,
Expand Down

0 comments on commit 9308e0d

Please sign in to comment.