mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-21 12:29: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}`;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue