Skip to content

Commit

Permalink
refactor: Update PlanService to validate date within 30 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
PleBea committed Jul 18, 2024
1 parent c36f554 commit f850437
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/plan/plan.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class PlanService {
}

async createPlan({ id }: User, dto: CreatePlanDTO) {
if (Math.abs(DateTime.fromISO(dto.date).diffNow('minutes').minutes) <= 30)
if (DateTime.fromISO(dto.date).diffNow('minutes').minutes >= -30)
throw new HttpException('Invalid date', HttpStatus.BAD_REQUEST);

const user = await this.prisma.user.findUnique({
Expand Down

0 comments on commit f850437

Please sign in to comment.