import { formatDate } from '$lib/shared/utils/date'; type AuthorSummary = { firstName?: string; lastName?: string; email: string }; type AuthorView = { displayName: string }; export function formatAuthorName(author: AuthorSummary | null | undefined): string { if (!author) return ''; const full = [author.firstName, author.lastName].filter(Boolean).join(' ').trim(); return full || author.email || ''; } export function formatAuthorDisplayName(author: AuthorView | null | undefined): string { return author?.displayName ?? ''; } export function formatPublishedAt( publishedAt: string | null | undefined, style: 'short' | 'long' = 'short' ): string | null { if (!publishedAt) return null; return formatDate(publishedAt.slice(0, 10), style); }