feat: enhance relative time parsing and clean up reminder text handling

This commit is contained in:
2025-09-28 01:41:01 -05:00
parent ffa69f2330
commit c7855c84e2

View File

@@ -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).');