mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
b36ab58f87
fixes: #2873 ![image](https://github.com/Unleash/unleash/assets/158948/7d5bb8ee-6b88-49ad-8c51-474e19dc833d)
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
export const formatDateYMDHMS = (
|
|
date: number | string | Date,
|
|
locale: string
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
day: '2-digit',
|
|
month: '2-digit',
|
|
year: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
second: '2-digit',
|
|
});
|
|
};
|
|
|
|
export const formatDateYMDHM = (
|
|
date: number | string | Date,
|
|
locale: string
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
day: '2-digit',
|
|
month: '2-digit',
|
|
year: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
});
|
|
};
|
|
|
|
export const formatDateYMD = (
|
|
date: number | string | Date,
|
|
locale: string
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
day: '2-digit',
|
|
month: '2-digit',
|
|
year: 'numeric',
|
|
});
|
|
};
|
|
|
|
export const formatDateHM = (
|
|
date: number | string | Date,
|
|
locale: string
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
});
|
|
};
|