commit
43893bab27
|
|
@ -201,11 +201,14 @@ function round(n, dp) {
|
||||||
var p = Math.max(0,Math.min(dp,dp - Math.floor(Math.log(n)/Math.log(10))));
|
var p = Math.max(0,Math.min(dp,dp - Math.floor(Math.log(n)/Math.log(10))));
|
||||||
return n.toFixed(p);
|
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) {
|
function getHours(d) {
|
||||||
var h = d.getHours();
|
var h = d.getHours();
|
||||||
if (is12 === undefined) is12 = ${isLocal ? "false" : `(require('Storage').readJSON('setting.json', 1) || {})["12hour"]`};
|
if (!is12Hours()) return ('0' + h).slice(-2);
|
||||||
if (!is12) return ('0' + h).slice(-2);
|
|
||||||
return ((h % 12 == 0) ? 12 : h % 12).toString();
|
return ((h % 12 == 0) ? 12 : h % 12).toString();
|
||||||
}
|
}
|
||||||
exports = {
|
exports = {
|
||||||
|
|
@ -234,7 +237,8 @@ exports = {
|
||||||
translate: s => ${locale.trans?`{var t=${js(locale.trans)};s=''+s;return t[s]||t[s.toLowerCase()]||s;}`:`s`},
|
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}\`,
|
date: (d,short) => short ? \`${dateS}\` : \`${dateN}\`,
|
||||||
time: (d,short) => short ? \`${timeS}\` : \`${timeN}\`,
|
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()
|
`.trim()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue