feat(ticket): redesign audit timeline with structured history events
This commit is contained in:
@@ -4,4 +4,25 @@ export function formatDate(value: string | null | undefined) {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function formatDateOnly(value: string | null | undefined) {
|
||||
if (!value) return '-';
|
||||
return new Intl.DateTimeFormat('en-IN', { dateStyle: 'medium' }).format(
|
||||
new Date(value),
|
||||
);
|
||||
}
|
||||
|
||||
export function formatTimelineDateTime(value: string | null | undefined) {
|
||||
if (!value) return { date: '-', time: '-' };
|
||||
|
||||
const parsed = new Date(value);
|
||||
return {
|
||||
date: new Intl.DateTimeFormat('en-IN', { dateStyle: 'medium' }).format(
|
||||
parsed,
|
||||
),
|
||||
time: new Intl.DateTimeFormat('en-IN', { timeStyle: 'short' }).format(
|
||||
parsed,
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './routes';
|
||||
export * from './date';
|
||||
export * from './date';
|
||||
export * from './person';
|
||||
8
src/utils/person.ts
Normal file
8
src/utils/person.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { TicketActor } from '@/types';
|
||||
|
||||
export function getPersonLabel(
|
||||
person: TicketActor | null | undefined,
|
||||
fallback = 'Unknown',
|
||||
) {
|
||||
return person?.name || person?.email || fallback;
|
||||
}
|
||||
Reference in New Issue
Block a user