Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

342 B
Raw Blame
import { format, isAfter, subYears } from "date-fns";

export default function BookmarkFormattedCreatedAt(prop: { createdAt: Date }) {
  const createdAt = prop.createdAt;
  const oneYearAgo = subYears(new Date(), 1);
  const formatString = isAfter(createdAt, oneYearAgo) ? "MMM d" : "MMM d, yyyy";
  return format(createdAt, formatString);
}