Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 2504dfe

Browse files
committed
fixed 24 hour time to 00:XX insteado of 24:XX
1 parent c157621 commit 2504dfe

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

docs/app-6276cddc0f7af977e06e.js renamed to docs/app-de4e187b7364886c19cc.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>Multiple Timezones Clock</title><style>body {
22
font-family: Arial, Helvetica, sans-serif;
3-
}</style><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><link rel="shortcut icon" href="./resources/favicon.ico"/><script defer="defer" src="./app-6276cddc0f7af977e06e.js"></script></head><body><div id="main"></div></body></html>
3+
}</style><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><link rel="shortcut icon" href="./resources/favicon.ico"/><script defer="defer" src="./app-de4e187b7364886c19cc.js"></script></head><body><div id="main"></div></body></html>

src/modules/my/child/child.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,28 @@ export default class Child extends SLDSLightningElement {
2727
set time(value) {
2828
let optionsMilitary = {
2929
hour12: this.is12Hours,
30-
hour: '2-digit',
30+
hour: 'numeric',
3131
minute: '2-digit'
3232
};
3333

3434
if (this.refreshInterval === 'second') {
3535
optionsMilitary.second = '2-digit';
3636
}
3737

38-
this._time = value.toLocaleString('en-US', {
39-
...optionsMilitary,
40-
timeZone: this.timeZone
41-
});
38+
let [hh, mm] = value
39+
.toLocaleString('en-US', {
40+
...optionsMilitary,
41+
timeZone: this.timeZone
42+
})
43+
.split(':');
44+
45+
if (parseInt(hh, 10) === 24) {
46+
hh = '00';
47+
}
48+
49+
this._time =
50+
hh === '00' && mm === '00' ? '24:00' : (hh +":"+ mm).replace(/^24/, '00');
51+
4252
let dateOptions = {
4353
year: 'numeric',
4454
month: '2-digit',

0 commit comments

Comments
 (0)