import dayjs from "dayjs"; import isBetween from "dayjs/plugin/isBetween"; // Add this line import { CalendarClockIcon } from "lucide-react"; import { Link } from "react-router"; import { Badge } from "src/components/ui/badge"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "src/components/ui/tooltip"; import { App } from "src/types"; dayjs.extend(isBetween); // Extend dayjs with the isBetween plugin type AppCardNoticeProps = { app: App; }; export function AppCardNotice({ app }: AppCardNoticeProps) { const now = dayjs(); const expiresAt = dayjs(app.expiresAt); const isExpired = expiresAt.isBefore(now); const expiresSoon = expiresAt.isBetween(now, now.add(7, "days")); return (
{app.expiresAt ? ( isExpired ? ( Expired Expired {expiresAt.fromNow()} ) : expiresSoon ? ( Expires Soon Expires {expiresAt.fromNow()} ) : null ) : null}
); }