From 0d4afaf7a219034a022dad3efaaaedc77c744218 Mon Sep 17 00:00:00 2001
From: Matthew Roberts <thew.roberts@gmail.com>
Date: Wed, 22 Mar 2023 16:37:18 -0400
Subject: [PATCH 1/2] More flexible time string parser.

---
 src/App.tsx | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/App.tsx b/src/App.tsx
index 5a65897..d982b2a 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -12,13 +12,11 @@ let seconds = safeParseNumber(params.seconds);
 let fontSize = '20vw';
 
 if (params.time) {
-  const parts = params.time.match(/(\d+)h(\d+)m(\d+)s/);
-  if (parts) {
-    const [, hours, minutes, s] = parts;
-    params.hours = hours;
-    params.minutes = minutes;
-    seconds = safeParseNumber(s);
-  }
+
+  seconds = safeArray.from(time.matchAll(/(\d+[hms])/g)).reduce((sum, [raw]) => {
+    const [n, x] = [raw.slice(0, -1), raw.at(-1)];
+    return sum + (n * (x == "h" ? 3600 : (x == "m" ? 60 : 1)))
+  }, 0);
 }
 
 if (params.hours) {

From 2afa09409d0f3cad5b17543526f301dfb8501ebb Mon Sep 17 00:00:00 2001
From: Matthew Roberts <thew.roberts@gmail.com>
Date: Wed, 22 Mar 2023 16:39:00 -0400
Subject: [PATCH 2/2] =?UTF-8?q?Better=20time=20string=20parsing=E2=80=94up?=
 =?UTF-8?q?dated?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/App.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/App.tsx b/src/App.tsx
index d982b2a..0467596 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -13,7 +13,7 @@ let fontSize = '20vw';
 
 if (params.time) {
 
-  seconds = safeArray.from(time.matchAll(/(\d+[hms])/g)).reduce((sum, [raw]) => {
+  seconds = safeArray.from(params.time.matchAll(/(\d+[hms])/g)).reduce((sum, [raw]) => {
     const [n, x] = [raw.slice(0, -1), raw.at(-1)];
     return sum + (n * (x == "h" ? 3600 : (x == "m" ? 60 : 1)))
   }, 0);