From: Michael Orlitzky Date: Wed, 1 Nov 2023 19:14:23 +0000 (-0400) Subject: index.html.in: ten-minute expiry for commuter bus tickets X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=0e1b4682be6b08731bc5ed4c2a983602cbf1c98f;p=charm-bypass.git index.html.in: ten-minute expiry for commuter bus tickets --- 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();