Skip to content

Commit

Permalink
Fix date validation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
newracket committed Feb 15, 2024
1 parent 839b534 commit 3b0ae17
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/commands/Checkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ export default class Checkin extends Command {
const day = dateMatches?.[3] ? parseInt(dateMatches[3], 10) : DateTime.now().day;
const year = dateMatches?.[6] ? parseInt(dateMatches[6], 10) : DateTime.now().year;

if (month < 1 || month > 12 || day < 1 || day > 31) {
await super.respond(interaction, {
content: 'Invalid date. Please use a valid date.',
ephemeral: true,
});
return;
}

// By default, we want the QR code to be DMed to the user.
const isPublic = publicArgument !== null ? publicArgument : false;
// By default, we want to include the slide.
Expand Down

0 comments on commit 3b0ae17

Please sign in to comment.