From c7855c84e28b9ef447bf14b4fcc3a301ea633467 Mon Sep 17 00:00:00 2001 From: shni Date: Sun, 28 Sep 2025 01:41:01 -0500 Subject: [PATCH] feat: enhance relative time parsing and clean up reminder text handling --- src/commands/messages/others/recordar.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/commands/messages/others/recordar.ts b/src/commands/messages/others/recordar.ts index 82621f1..624ae7e 100644 --- a/src/commands/messages/others/recordar.ts +++ b/src/commands/messages/others/recordar.ts @@ -187,6 +187,7 @@ export const command: CommandMessage = { const r = results[0]; when = r.date(); + // Nota: validación completa al final también if (!when || isNaN(when.getTime())) { await message.reply('❌ La fecha/hora no es válida.'); return; @@ -209,6 +210,12 @@ export const command: CommandMessage = { } } + // Validación robusta antes de usar getTime/toISOString + if (!(when instanceof Date) || isNaN(when.getTime())) { + await message.reply('❌ La fecha/hora interpretada no es válida. Intenta con un formato distinto.'); + return; + } + // Validaciones de futuro y límites mínimos if (when.getTime() <= Date.now() + 20 * 1000) { // al menos 20s al futuro await message.reply('❌ Especifica un tiempo al futuro (al menos ~20 segundos).');