mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-07 21:13:11 +08:00
Added current time to header
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user