feat: enhance relative time parsing and clean up reminder text handling
This commit is contained in:
@@ -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).');
|
||||
|
||||
Reference in New Issue
Block a user