From 39f9d66041042a7cb16e8a007b20d3328e7672bc Mon Sep 17 00:00:00 2001 From: stweedo <108593831+stweedo@users.noreply.github.com> Date: Tue, 30 May 2023 19:00:26 -0500 Subject: [PATCH 1/2] Update locale.html to remove leading zero in 12 hour mode --- apps/locale/locale.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/locale/locale.html b/apps/locale/locale.html index 6eb0d94ea..f9d89f846 100644 --- a/apps/locale/locale.html +++ b/apps/locale/locale.html @@ -156,7 +156,7 @@ exports = { name : "en_GB", currencySym:"£", "%-m": "d.getMonth()+1", "%d": "('0'+d.getDate()).slice(-2)", "%-d": "d.getDate()", - "%HH": "('0'+getHours(d)).slice(-2)", + "%HH": "getHours(d)", "%MM": "('0'+d.getMinutes()).slice(-2)", "%SS": "('0'+d.getSeconds()).slice(-2)", "%A": `${js(locale.day)}.split(',')[d.getDay()]`, @@ -191,9 +191,9 @@ function round(n, dp) { var is12; function getHours(d) { var h = d.getHours(); - if (is12===undefined) is12 = (require('Storage').readJSON('setting.json',1)||{})["12hour"]; - if (!is12) return h; - return (h%12==0) ? 12 : h%12; + if (is12 === undefined) is12 = (require('Storage').readJSON('setting.json', 1) || {})["12hour"]; + if (!is12) return ('0'+h).slice(-2); // return with leading zero in 24-hour format + return (h % 12 == 0) ? 12 : h % 12; } exports = { name: ${js(locale.lang)}, From 7df499d2772d03c6b2fe66d5c69eb0a9702844e0 Mon Sep 17 00:00:00 2001 From: stweedo <108593831+stweedo@users.noreply.github.com> Date: Wed, 31 May 2023 01:44:26 -0500 Subject: [PATCH 2/2] Update locale.html - fixes missing lead zero in 24 hour mode --- apps/locale/locale.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/locale/locale.html b/apps/locale/locale.html index f9d89f846..72c862da0 100644 --- a/apps/locale/locale.html +++ b/apps/locale/locale.html @@ -192,8 +192,8 @@ var is12; function getHours(d) { var h = d.getHours(); if (is12 === undefined) is12 = (require('Storage').readJSON('setting.json', 1) || {})["12hour"]; - if (!is12) return ('0'+h).slice(-2); // return with leading zero in 24-hour format - return (h % 12 == 0) ? 12 : h % 12; + if (!is12) return ('0' + h).slice(-2); + return ((h % 12 == 0) ? 12 : h % 12).toString(); } exports = { name: ${js(locale.lang)},