From db601c639b54a48259fa6a37fccef0eddf0993bb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 21:54:19 +0000 Subject: [PATCH] Parse Wilton's times written with a colon Some Wilton's times use a colon ("2:30 pm") rather than a dot ("7.30 pm"), which the time format rejected, failing the transform. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PPQC7pUHLSSD6ayU5cZiBQ --- cinemas/wiltons.org.uk/transform.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cinemas/wiltons.org.uk/transform.js b/cinemas/wiltons.org.uk/transform.js index 6a6c15c9..1f55e43f 100644 --- a/cinemas/wiltons.org.uk/transform.js +++ b/cinemas/wiltons.org.uk/transform.js @@ -11,16 +11,19 @@ const { } = require("../../common/utils"); const attributes = require("./attributes"); -// Table dates/times are given as "Wed 29 Jul" + "7 pm" (or "7.30 pm"), with -// the year only added for dates outside the current year ("Wed 31 Mar 2027"). -// Without a year, roll dates well in the past over to next year. +// Table dates/times are given as "Wed 29 Jul" + "7 pm" (or "7.30 pm" or +// "2:30 pm"), with the year only added for dates outside the current year +// ("Wed 31 Mar 2027"). Without a year, roll dates well in the past over to next +// year. const parsePerformanceDate = (dateText, timeText) => { const now = new Date(); const hasYear = /\b\d{4}$/.test(dateText); const dateFormat = hasYear ? "EEE d MMM yyyy" : "EEE d MMM"; - const timeFormat = /\d\.\d/.test(timeText) ? "h.mm a" : "h a"; + // Minutes are separated by either "." or ":" + const normalisedTime = timeText.replace(/(\d):(\d)/, "$1.$2"); + const timeFormat = /\d\.\d/.test(normalisedTime) ? "h.mm a" : "h a"; let date = parse( - `${dateText} ${timeText}`, + `${dateText} ${normalisedTime}`, `${dateFormat} ${timeFormat}`, now, { locale: enGB },