From dc41cabe4dd99b30c337183eed849765d906c5dd Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 13:07:34 +0200 Subject: [PATCH] Add 12-hour format (hh) and AM/PM (a) tokens to time formatter --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.html b/index.html index 782497d..a937142 100644 --- a/index.html +++ b/index.html @@ -832,6 +832,14 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({ } else if (ch === 'H' && format.substr(i, 2) === 'HH') { result += pad2(date.getHours()); i += 2; + } else if (ch === 'h' && format.substr(i, 2) === 'hh') { + var h12 = date.getHours() % 12; + if (h12 === 0) h12 = 12; + result += pad2(h12); + i += 2; + } else if (ch === 'a') { + result += date.getHours() < 12 ? 'AM' : 'PM'; + i += 1; } else if (ch === 'm' && format.substr(i, 2) === 'mm') { result += pad2(date.getMinutes()); i += 2;