diff --git a/apps/locale/locale.html b/apps/locale/locale.html
index 8ec818aaea..ae8cd82045 100644
--- a/apps/locale/locale.html
+++ b/apps/locale/locale.html
@@ -204,11 +204,14 @@
var p = Math.max(0,Math.min(dp,dp - Math.floor(Math.log(n)/Math.log(10))));
return n.toFixed(p);
}
-var is12;
+var _is12Hours;
+function is12Hours() {
+ if (_is12Hours === undefined) _is12Hours = ${isLocal ? "false" : `(require('Storage').readJSON('setting.json', 1) || {})["12hour"]`};
+ return _is12Hours;
+}
function getHours(d) {
var h = d.getHours();
- if (is12 === undefined) is12 = ${isLocal ? "false" : `(require('Storage').readJSON('setting.json', 1) || {})["12hour"]`};
- if (!is12) return ('0' + h).slice(-2);
+ if (!is12Hours()) return ('0' + h).slice(-2);
return ((h % 12 == 0) ? 12 : h % 12).toString();
}
exports = {
@@ -237,7 +240,8 @@
translate: s => ${locale.trans?`{var t=${js(locale.trans)};s=''+s;return t[s]||t[s.toLowerCase()]||s;}`:`s`},
date: (d,short) => short ? \`${dateS}\` : \`${dateN}\`,
time: (d,short) => short ? \`${timeS}\` : \`${timeN}\`,
- meridian: d => d.getHours() < 12 ? ${js(locale.ampm[0])}:${js(locale.ampm[1])},
+ meridian: d => is12Hours() ? d.getHours() < 12 ? ${js(locale.ampm[0])}:${js(locale.ampm[1])} : "",
+ is12Hours,
};
`.trim()
};