spink na zejtra

This commit is contained in:
Histmy 2023-06-04 20:53:16 +02:00
parent b32fcb6be2
commit 542130d9a3

View File

@ -129,18 +129,17 @@ const exp: Modul = {
} else if (/^\d+$/.test(kdy) || !kdy)
spink.setTime(tedT + Number(kdy || 7200) * 1000);
else {
const cojavim = /^((?<d>\d+)\. ?((?<mo>\d+)\.)? ?|(?<z>z([ií]|ej)tra) )?(?<h>\d+)(:(?<m>\d+)(:(?<s>\d+))?)? ?(?<p>am|pm)?$/.exec(kdy.toLowerCase());
const cojavim = /^((?<d>\d+)\. ?((?<mo>\d+)\.)? ?)?(?<h>\d+)(:(?<m>\d+)(:(?<s>\d+))?)? ?(?<p>am|pm)?$/.exec(kdy.toLowerCase());
if (!cojavim) return `cos to tam napsal ty kokote?`;
const g = cojavim.groups!;
if (g.d) spink.setDate(Number(g.d));
if (g.z) spink.setDate(ted.getDate() + 1);
if (g.mo) spink.setMonth(Number(g.mo) - 1);
const h = Number(g.h);
spink.setHours(g.p == "pm" && h < 12 ? h + 12 : h);
spink.setMinutes(Number(g.m) || 0);
spink.setSeconds(Number(g.s) || 0);
if (Number(spink) < tedT) return "to uz bylo ty magore";
if (Number(spink) < tedT) spink.setDate(ted.getDate() + 1);
}
ifUzRemove(mes);