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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user