blob: a3e5d3b36bac43223ae522aa409e831c827c9744 (
plain) (
blame)
1
2
3
4
5
6
7
8
|
import dayjs from "dayjs";
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);
}
|