blog/src/components/Timestamp.astro

14 lines
288 B
Plaintext

---
interface Props {
timestamp: Date;
format: string | undefined;
}
const { timestamp, format: customFormat } = Astro.props;
import { format } from "date-fns";
---
<span class="timestamp" title={timestamp.toISOString()}>
{format(timestamp, customFormat ?? "yyyy MMM d")}
</span>