forked from Yara724/api
fix claim validation and expert branch scoping
This commit is contained in:
@@ -26,6 +26,7 @@ function normalizeTimeToHms(time: string): string | null {
|
||||
const hh = m[1].padStart(2, "0");
|
||||
const mm = m[2];
|
||||
const ss = m[3] ?? "00";
|
||||
if (Number(hh) > 23 || Number(mm) > 59 || Number(ss) > 59) return null;
|
||||
return `${hh}:${mm}:${ss}`;
|
||||
}
|
||||
|
||||
@@ -56,7 +57,12 @@ export function parseIranLocalDateTime(
|
||||
|
||||
if (/[zZ]|[+-]\d{2}:?\d{2}$/.test(raw)) {
|
||||
const d = new Date(raw);
|
||||
return Number.isNaN(d.getTime()) ? null : d;
|
||||
if (Number.isNaN(d.getTime())) return null;
|
||||
const cleanTime = (time ?? "").trim();
|
||||
if (!cleanTime) return d;
|
||||
const timeHms = normalizeTimeToHms(cleanTime);
|
||||
if (!timeHms) return null;
|
||||
return parseIranLocalIso(gregorianDateInIran(d), timeHms);
|
||||
}
|
||||
|
||||
const naive = raw.match(NAIVE_ISO_DATETIME_RE);
|
||||
|
||||
Reference in New Issue
Block a user