From b16fa5e21a3852151c6b3d3d5569154d863d1795 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 1 Feb 2026 19:26:23 +0000 Subject: chore: replace dayjs with data-fns --- apps/mobile/components/highlights/HighlightCard.tsx | 7 ++----- apps/mobile/package.json | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'apps/mobile') diff --git a/apps/mobile/components/highlights/HighlightCard.tsx b/apps/mobile/components/highlights/HighlightCard.tsx index fd5ff752..31b3c829 100644 --- a/apps/mobile/components/highlights/HighlightCard.tsx +++ b/apps/mobile/components/highlights/HighlightCard.tsx @@ -3,8 +3,7 @@ import * as Haptics from "expo-haptics"; import { useRouter } from "expo-router"; import { Text } from "@/components/ui/Text"; import { useQuery } from "@tanstack/react-query"; -import dayjs from "dayjs"; -import relativeTime from "dayjs/plugin/relativeTime"; +import { formatDistanceToNow } from "date-fns"; import { ExternalLink, Trash2 } from "lucide-react-native"; import type { ZHighlight } from "@karakeep/shared/types/highlights"; @@ -13,8 +12,6 @@ import { useTRPC } from "@karakeep/shared-react/trpc"; import { useToast } from "../ui/Toast"; -dayjs.extend(relativeTime); - // Color map for highlights (mapped to Tailwind CSS classes used in NativeWind) const HIGHLIGHT_COLOR_MAP = { red: "#fecaca", // bg-red-200 @@ -108,7 +105,7 @@ export default function HighlightCard({ - {dayjs(highlight.createdAt).fromNow()} + {formatDistanceToNow(highlight.createdAt, { addSuffix: true })} {bookmark && ( <> diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 47ef533d..7f85a2f7 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -29,6 +29,7 @@ "@tanstack/react-query": "5.90.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", + "date-fns": "^3.6.0", "expo": "~54.0.31", "expo-build-properties": "~1.0.10", "expo-checkbox": "~5.0.8", -- cgit v1.2.3-70-g09d2