switch to nx monorepo

This commit is contained in:
Philipinho
2024-01-09 18:58:26 +01:00
parent e1bb2632b8
commit 093e634c0b
273 changed files with 11419 additions and 31 deletions

View File

@ -0,0 +1,16 @@
import { formatDistanceStrict } from 'date-fns';
import { format, isToday, isYesterday } from 'date-fns';
export function timeAgo(date: Date) {
return formatDistanceStrict(new Date(date), new Date(), { addSuffix: true });
}
export function formatDate(date: Date) {
if (isToday(date)) {
return `Today, ${format(date, 'h:mma')}`;
} else if (isYesterday(date)) {
return `Yesterday, ${format(date, 'h:mma')}`;
} else {
return format(date, 'MMM dd, yyyy, h:mma');
}
}