2022-02-25 10:40:55 +01:00
|
|
|
export const formatDateYMDHMS = (
|
|
|
|
date: number | string | Date,
|
2024-01-03 13:48:43 +01:00
|
|
|
locale?: string,
|
2022-02-25 10:40:55 +01:00
|
|
|
): string => {
|
|
|
|
return new Date(date).toLocaleString(locale, {
|
|
|
|
day: '2-digit',
|
|
|
|
month: '2-digit',
|
|
|
|
year: 'numeric',
|
|
|
|
hour: '2-digit',
|
|
|
|
minute: '2-digit',
|
|
|
|
second: '2-digit',
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-06-27 09:14:45 +02:00
|
|
|
export const formatDateYMDHM = (
|
|
|
|
date: number | string | Date,
|
2023-10-02 14:25:46 +02:00
|
|
|
locale: string,
|
2024-01-11 10:39:58 +01:00
|
|
|
timeZone?: string,
|
2023-06-27 09:14:45 +02:00
|
|
|
): string => {
|
|
|
|
return new Date(date).toLocaleString(locale, {
|
|
|
|
day: '2-digit',
|
|
|
|
month: '2-digit',
|
|
|
|
year: 'numeric',
|
|
|
|
hour: '2-digit',
|
|
|
|
minute: '2-digit',
|
2024-01-11 10:39:58 +01:00
|
|
|
timeZone,
|
2023-06-27 09:14:45 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-02-25 10:40:55 +01:00
|
|
|
export const formatDateYMD = (
|
|
|
|
date: number | string | Date,
|
2023-10-02 14:25:46 +02:00
|
|
|
locale: string,
|
2024-01-11 10:39:58 +01:00
|
|
|
timeZone?: string,
|
2022-02-25 10:40:55 +01:00
|
|
|
): string => {
|
|
|
|
return new Date(date).toLocaleString(locale, {
|
|
|
|
day: '2-digit',
|
|
|
|
month: '2-digit',
|
|
|
|
year: 'numeric',
|
2024-01-11 10:39:58 +01:00
|
|
|
timeZone,
|
2022-02-25 10:40:55 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const formatDateHM = (
|
|
|
|
date: number | string | Date,
|
2023-10-02 14:25:46 +02:00
|
|
|
locale: string,
|
2022-02-25 10:40:55 +01:00
|
|
|
): string => {
|
|
|
|
return new Date(date).toLocaleString(locale, {
|
|
|
|
hour: '2-digit',
|
|
|
|
minute: '2-digit',
|
|
|
|
});
|
|
|
|
};
|