mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 03:45:53 -05:00
12 lines
390 B
TypeScript
12 lines
390 B
TypeScript
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();
|
|
}
|