mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-29 07:39:36 +02:00
Added current time to header
This commit is contained in:
parent
76e68db06f
commit
ea57dbf750
10 changed files with 57 additions and 17 deletions
|
@ -1,3 +1,5 @@
|
|||
import { parseTime } from '../../../../utility';
|
||||
|
||||
export const getDateTime = (): string => {
|
||||
const days = localStorage.getItem('daySchema')?.split(';') || [
|
||||
'Sunday',
|
||||
|
@ -27,14 +29,23 @@ export const getDateTime = (): string => {
|
|||
const now = new Date();
|
||||
|
||||
const useAmericanDate = localStorage.useAmericanDate === 'true';
|
||||
const showTime = localStorage.showTime === 'true';
|
||||
|
||||
const p = parseTime;
|
||||
|
||||
const time = `${p(now.getHours())}:${p(now.getMinutes())}:${p(
|
||||
now.getSeconds()
|
||||
)}`;
|
||||
|
||||
const timeEl = showTime ? ` - ${time}` : '';
|
||||
|
||||
if (!useAmericanDate) {
|
||||
return `${days[now.getDay()]}, ${now.getDate()} ${
|
||||
months[now.getMonth()]
|
||||
} ${now.getFullYear()}`;
|
||||
} ${now.getFullYear()}${timeEl}`;
|
||||
} else {
|
||||
return `${days[now.getDay()]}, ${
|
||||
months[now.getMonth()]
|
||||
} ${now.getDate()} ${now.getFullYear()}`;
|
||||
} ${now.getDate()} ${now.getFullYear()}${timeEl}`;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -172,8 +172,8 @@ export const OtherSettings = (): JSX.Element => {
|
|||
</select>
|
||||
</InputGroup>
|
||||
|
||||
{/* MODULES OPTIONS */}
|
||||
<SettingsHeadline text="Modules" />
|
||||
{/* HEADER OPTIONS */}
|
||||
<SettingsHeadline text="Header" />
|
||||
{/* HIDE HEADER */}
|
||||
<InputGroup>
|
||||
<label htmlFor="hideHeader">Hide greeting and date</label>
|
||||
|
@ -233,6 +233,22 @@ export const OtherSettings = (): JSX.Element => {
|
|||
<span>Names must be separated with semicolon</span>
|
||||
</InputGroup>
|
||||
|
||||
{/* SHOW TIME */}
|
||||
<InputGroup>
|
||||
<label htmlFor="showTime">Show time</label>
|
||||
<select
|
||||
id="showTime"
|
||||
name="showTime"
|
||||
value={formData.showTime ? 1 : 0}
|
||||
onChange={(e) => inputChangeHandler(e, { isBool: true })}
|
||||
>
|
||||
<option value={1}>True</option>
|
||||
<option value={0}>False</option>
|
||||
</select>
|
||||
</InputGroup>
|
||||
|
||||
{/* MODULES OPTIONS */}
|
||||
<SettingsHeadline text="Modules" />
|
||||
{/* HIDE APPS */}
|
||||
<InputGroup>
|
||||
<label htmlFor="hideApps">Hide applications</label>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue