mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-02 01:17:58 +02:00
https://linear.app/unleash/issue/2-2663/implement-event-grouping-when-multiple-events-happen-in-a-short-period This PR introduces a grouping logic for timeline events, enhancing the way events are displayed when they occur close to each other. We also updated and refactored components to support handling groups of events rather than individual events. Also includes some minor code cleanups and optimizations as part of general refactoring efforts (scouting).  --------- Co-authored-by: David Leek <david@getunleash.io>
63 lines
1.4 KiB
TypeScript
63 lines
1.4 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,
|
|
timeZone?: string,
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
day: '2-digit',
|
|
month: '2-digit',
|
|
year: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
timeZone,
|
|
});
|
|
};
|
|
|
|
export const formatDateYMD = (
|
|
date: number | string | Date,
|
|
locale: string,
|
|
timeZone?: string,
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
day: '2-digit',
|
|
month: '2-digit',
|
|
year: 'numeric',
|
|
timeZone,
|
|
});
|
|
};
|
|
|
|
export const formatDateHM = (
|
|
date: number | string | Date,
|
|
locale: string,
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
});
|
|
};
|
|
|
|
export const formatDateHMS = (
|
|
date: number | string | Date,
|
|
locale: string,
|
|
): string => {
|
|
return new Date(date).toLocaleString(locale, {
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
second: '2-digit',
|
|
});
|
|
};
|