From 62916c7d765c5a56d321de7622cc8890ec6ce900 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 19:04:20 +0000 Subject: [PATCH] Parse multi-day Tito events Queer East's In the Mist events run 4pm, October 21st to 8pm, October 22nd, which Tito renders with a date on both ends. The parser assumed a same-day range and failed on the start. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014oHUvXMcpjGqjMk9dKyfxV --- sources/ti.to/find-events.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sources/ti.to/find-events.js b/sources/ti.to/find-events.js index 16021d66..363697a5 100644 --- a/sources/ti.to/find-events.js +++ b/sources/ti.to/find-events.js @@ -46,10 +46,27 @@ function parseTitoTime(text, referenceDate) { throw new Error(`Failed to parse Tito time: "${text}"`); } +/** + * Parse the start of an event spanning several days, which carries its own + * date but not the year (e.g. "4pm, October 21st"). The year is the end + * date's, stepping back one when the event runs over New Year. + */ +function parseTitoStartDateTime(text, endDate) { + const year = endDate.getFullYear(); + const startDate = parseTitoDateTime(`${text}, ${year}`); + if (startDate > endDate) { + return parseTitoDateTime(`${text}, ${year - 1}`); + } + return startDate; +} + /** * Parse the calendar text from a Tito event page. * Format: "START–ENDam/pm, MONTH DAYth, YEAR" * e.g. "2–4:15pm, February 21st, 2026" + * or, for an event spanning several days: + * "START, MONTH DAYth–END, MONTH DAYth, YEAR" + * e.g. "4pm, October 21st–8pm, October 22nd, 2026" */ function parseCalText(calText) { const [startTimeStr, endTimeAndDate] = calText.split("\u2013"); @@ -60,6 +77,12 @@ function parseCalText(calText) { // Parse end time + date directly (e.g. "4:15pm, February 21st, 2026") const endDate = parseTitoDateTime(endTimeAndDate.trim()); + // An event spanning several days gives its start a date of its own + if (startTimeStr.includes(",")) { + const startDate = parseTitoStartDateTime(startTimeStr.trim(), endDate); + return { startDate, endDate }; + } + // Start time omits am/pm when same as end — inherit it const amPm = endTimeAndDate.match(/(am|pm)/i)?.[1]; if (!amPm) {