diff --git a/src/components/modals/main/settings/sections/Time.jsx b/src/components/modals/main/settings/sections/Time.jsx index 8992438c..14cdea0b 100644 --- a/src/components/modals/main/settings/sections/Time.jsx +++ b/src/components/modals/main/settings/sections/Time.jsx @@ -128,6 +128,9 @@ export default class TimeSettings extends PureComponent { + {timeSettings} diff --git a/src/components/widgets/time/Clock.jsx b/src/components/widgets/time/Clock.jsx index 7cc2d31d..d7228ccd 100644 --- a/src/components/widgets/time/Clock.jsx +++ b/src/components/widgets/time/Clock.jsx @@ -16,6 +16,9 @@ export default class Clock extends PureComponent { this.timer = undefined; this.state = { time: '', + finalHour: '', + finalMinute: '', + finalSeconds: '', ampm: '', nowGlobal: new Date(), }; @@ -57,15 +60,24 @@ export default class Clock extends PureComponent { if (localStorage.getItem('seconds') === 'true') { sec = `:${('00' + now.getSeconds()).slice(-2)}`; + this.setState({ finalSeconds: `:${('00' + now.getSeconds()).slice(-2)}` }); } if (localStorage.getItem('timeformat') === 'twentyfourhour') { if (zero === 'false') { time = `${now.getHours()}:${('00' + now.getMinutes()).slice(-2)}${sec}`; + this.setState({ + finalHour: `${now.getHours()}`, + finalMinute: `${('00' + now.getMinutes()).slice(-2)}`, + }); } else { time = `${('00' + now.getHours()).slice(-2)}:${('00' + now.getMinutes()).slice( -2, )}${sec}`; + this.setState({ + finalHour: `${('00' + now.getHours()).slice(-2)}`, + finalMinute: `${('00' + now.getMinutes()).slice(-2)}`, + }); } this.setState({ @@ -84,8 +96,16 @@ export default class Clock extends PureComponent { if (zero === 'false') { time = `${hours}:${('00' + now.getMinutes()).slice(-2)}${sec}`; + this.setState({ + finalHour: `${hours}`, + finalMinute: `${('00' + now.getMinutes()).slice(-2)}`, + }); } else { time = `${('00' + hours).slice(-2)}:${('00' + now.getMinutes()).slice(-2)}${sec}`; + this.setState({ + finalHour: `${('00' + hours).slice(-2)}`, + finalMinute: `${('00' + now.getMinutes()).slice(-2)}`, + }); } this.setState({ @@ -170,6 +190,23 @@ export default class Clock extends PureComponent { ); } + if (localStorage.getItem('timeType') === 'modernClock') { + clockHTML = ( + <> + + {this.state.time} + {this.state.ampm} + + + {' '} +
{this.state.finalHour}
{' '} +
{this.state.finalMinute}
{' '} +
{this.state.finalSeconds}
{' '} +
+ + ); + } + return clockHTML; } }