fix(prayer): strip timezone suffix in parseTimeToMs, fix NaN countdown

The prayer API returns timings like '06:03 (MYT)' but parseTimeToMs
didn't strip '(MYT)' suffix, causing Number('03 (MYT)') → NaN.
Now regex-strips timezone annotations before parsing.

Also: updated Playwright visual QA test to authenticate before
testing auth-gated pages, uses domcontentloaded for Leaflet map page.

Grade A — 84 pass, 0 fail, 1 warn on production browser QA.
This commit is contained in:
root
2026-06-18 19:51:27 +02:00
parent 8849bd5459
commit 44f304fb6b
2 changed files with 172 additions and 128 deletions
+3 -1
View File
@@ -81,7 +81,9 @@ const DEFAULT_LOCATION: LocationSettings = {
// ── Helpers ──
function parseTimeToMs(timeStr: string, dayOffset = 0): number {
const [h, m] = timeStr.split(":").map(Number);
const clean = timeStr.replace(/\s*\(.*\)\s*$/, "").trim();
const [h, m] = clean.split(":").map(Number);
if (isNaN(h) || isNaN(m)) return 0;
const d = new Date();
d.setDate(d.getDate() + dayOffset);
d.setHours(h, m, 0, 0);