Files

12 lines
406 B
TypeScript
Raw Permalink Normal View History

2026-10-12 15:16:43 -04:00
import dayjs from '@/lib/dayjs';
2026-11-23 14:51:03 +00:00
/** Formats a date with dayjs tokens, advanced ones included, such as `lll` for a localized date and time. */
2026-10-12 15:16:43 -04:00
export function formatDate(date: string | Date, format: string): string {
return dayjs(date).format(format);
}
/** How long ago a date was, such as "3 hours ago". */
export function fromNow(date: string | Date): string {
return dayjs(date).fromNow();
}