Skip to content

Commit

Permalink
Fixed error message on bad date format in bot update. (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmoy12c authored Jul 27, 2023
1 parent 1cc65ba commit e1c7e33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/bot/bot.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
});
2 changes: 1 addition & 1 deletion src/modules/bot/bot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e1c7e33

Please sign in to comment.