From e1c7e33bff8f4ce0fd92b9904d92b7a4b936dfa8 Mon Sep 17 00:00:00 2001 From: Chinmoy Date: Thu, 27 Jul 2023 17:07:58 +0530 Subject: [PATCH] Fixed error message on bad date format in bot update. (#197) --- src/modules/bot/bot.service.spec.ts | 2 +- src/modules/bot/bot.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/bot/bot.service.spec.ts b/src/modules/bot/bot.service.spec.ts index daa5bfd..ed67f84 100644 --- a/src/modules/bot/bot.service.spec.ts +++ b/src/modules/bot/bot.service.spec.ts @@ -515,7 +515,7 @@ describe('BotService', () => { 'endDate': '1129-299-092' })) .rejects - .toThrowError(new BadRequestException(`Bad date format. Please provide date in 'yyyy-mm-yy' format.`)); + .toThrowError(new BadRequestException(`Bad date format. Please provide date in 'yyyy-mm-dd' format.`)); fetchMock.restore(); }) }); diff --git a/src/modules/bot/bot.service.ts b/src/modules/bot/bot.service.ts index 8072992..29a2171 100644 --- a/src/modules/bot/bot.service.ts +++ b/src/modules/bot/bot.service.ts @@ -479,7 +479,7 @@ export class BotService { if (updateBotDto.endDate) { const dateRegex: RegExp = /^\d{4}-\d{2}-\d{2}$/; if (!dateRegex.test(updateBotDto.endDate)) { - throw new BadRequestException(`Bad date format. Please provide date in 'yyyy-mm-yy' format.`) + throw new BadRequestException(`Bad date format. Please provide date in 'yyyy-mm-dd' format.`) } updateBotDto.endDate = new Date(updateBotDto.endDate); }