2021-11-05 16:39:42 +01:00
|
|
|
export const getDateTime = (): string => {
|
2021-11-05 17:16:19 +01:00
|
|
|
const days = localStorage.getItem('daySchema')?.split(';') || [
|
2021-10-22 15:51:11 +02:00
|
|
|
'Sunday',
|
|
|
|
'Monday',
|
|
|
|
'Tuesday',
|
|
|
|
'Wednesday',
|
|
|
|
'Thursday',
|
|
|
|
'Friday',
|
|
|
|
'Saturday',
|
|
|
|
];
|
2021-11-05 17:16:19 +01:00
|
|
|
|
|
|
|
const months = localStorage.getItem('monthSchema')?.split(';') || [
|
2021-10-22 15:51:11 +02:00
|
|
|
'January',
|
|
|
|
'February',
|
|
|
|
'March',
|
|
|
|
'April',
|
|
|
|
'May',
|
|
|
|
'June',
|
|
|
|
'July',
|
|
|
|
'August',
|
|
|
|
'September',
|
|
|
|
'October',
|
|
|
|
'November',
|
|
|
|
'December',
|
|
|
|
];
|
2021-06-13 01:06:42 +02:00
|
|
|
|
|
|
|
const now = new Date();
|
|
|
|
|
2021-10-22 15:51:11 +02:00
|
|
|
const useAmericanDate = localStorage.useAmericanDate === 'true';
|
|
|
|
|
|
|
|
if (!useAmericanDate) {
|
|
|
|
return `${days[now.getDay()]}, ${now.getDate()} ${
|
|
|
|
months[now.getMonth()]
|
|
|
|
} ${now.getFullYear()}`;
|
|
|
|
} else {
|
|
|
|
return `${days[now.getDay()]}, ${
|
|
|
|
months[now.getMonth()]
|
|
|
|
} ${now.getDate()} ${now.getFullYear()}`;
|
|
|
|
}
|
|
|
|
};
|