Files

12 lines
390 B
TypeScript
Raw Permalink Normal View History

2026-10-12 15:16:43 -04:00
import dayjs from '@/lib/dayjs';
/** Formats a date with dayjs tokens, advanced ones included, such as `MMM Do [at] h:mmA`. */
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();
}