From 0e1b4682be6b08731bc5ed4c2a983602cbf1c98f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 1 Nov 2023 15:14:23 -0400 Subject: [PATCH] index.html.in: ten-minute expiry for commuter bus tickets --- index.html.in | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/index.html.in b/index.html.in index b686203..421feda 100644 --- a/index.html.in +++ b/index.html.in @@ -418,11 +418,19 @@ * one-way tickets. */ const date = new Date(); - /* Add an hour and a half. We use the low-level get/setTime to - * change the number of milliseconds since the epoch that this - * date represents. Obviously correct, and avoids all suspicious - * corner cases (well, for a few more decades). */ - date.setTime(date.getTime() + (90*60*1000)); + /* BaltimoreLink and MARC Train are valid for an hour and a half */ + var minutes = 90; + let params = new URLSearchParams(document.location.search); + if (params.get("servicename") == "Commuter Bus") { + /* But commuter bus tickets are only valid for ten minutes */ + minutes = 10; + } + + /* We use the low-level get/setTime to change the number of + * milliseconds since the epoch that this date represents + * Obviously correct, and avoids all suspicious corner cases + * for a few more decades. */ + date.setTime(date.getTime() + (minutes*60*1000)); tt = document.getElementById("tickettime"); tt.textContent = date.toLocaleTimeString(); -- 2.43.2