From 83a326efc140899c3c607d9524f97e59c13d700a Mon Sep 17 00:00:00 2001 From: Geoffrey Allott Date: Wed, 9 Aug 2023 18:59:45 +0100 Subject: [PATCH] accept more datetime formats --- site/modules/datetime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/modules/datetime.js b/site/modules/datetime.js index 9499403..50c219f 100644 --- a/site/modules/datetime.js +++ b/site/modules/datetime.js @@ -1,5 +1,5 @@ export function parse_datetime(input) { - const re = /^(?:(?[0-9]{4})-(?[0-9]{1,2})-(?[0-9]{1,2})\s)?\s*(?[0-9]{1,2}):(?[0-9]{2})(?::(?[0-9]{2}))?$/; + const re = /^(?:(?[0-9]{4})-(?[0-9]{1,2})-(?[0-9]{1,2})\s)?\s*(?[0-9]{1,2}):(?[0-9]{1,2})(?::(?[0-9]{1,2}))?$/; const match = input.match(re); if (match === null) return null; const datetime = new Date(); @@ -30,7 +30,7 @@ export function stringify_datetime(millis) { } export function parse_duration(input) { - const re = /^(?:(?[0-9]{1,2}):)?(?[0-9]{2}):(?[0-9]{2})$/; + const re = /^(?:(?[0-9]{1,2}):)?(?[0-9]{1,2}):(?[0-9]{1,2})$/; const match = input.match(re); if (match === null) return null; return ((((match.groups.hours !== undefined ? +match.groups.hours : 0) * 60 + +match.groups.minutes) * 60) + +match.groups.seconds) * 1000; -- 2.34.1