aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2026-02-01 19:26:23 +0000
committerMohamed Bassem <me@mbassem.com>2026-02-01 19:26:23 +0000
commitb16fa5e21a3852151c6b3d3d5569154d863d1795 (patch)
tree4550462032a98c44a2c0581982e6676dee3d099b /apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx
parent45db6147032071d270fbf2b577a234393247d921 (diff)
downloadkarakeep-b16fa5e21a3852151c6b3d3d5569154d863d1795.tar.zst
chore: replace dayjs with data-fns
Diffstat (limited to 'apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx')
-rw-r--r--apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx b/apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx
index a3e5d3b3..7c254336 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarkFormattedCreatedAt.tsx
@@ -1,8 +1,8 @@
-import dayjs from "dayjs";
+import { format, isAfter, subYears } from "date-fns";
export default function BookmarkFormattedCreatedAt(prop: { createdAt: Date }) {
- const createdAt = dayjs(prop.createdAt);
- const oneYearAgo = dayjs().subtract(1, "year");
- const formatString = createdAt.isAfter(oneYearAgo) ? "MMM D" : "MMM D, YYYY";
- return createdAt.format(formatString);
+ const createdAt = prop.createdAt;
+ const oneYearAgo = subYears(new Date(), 1);
+ const formatString = isAfter(createdAt, oneYearAgo) ? "MMM d" : "MMM d, yyyy";
+ return format(createdAt, formatString);
}