Files
kycnotme/web/src/components/TimeFormatted.astro
2025-05-19 10:23:36 +00:00

17 lines
449 B
Plaintext

---
import { omit } from 'lodash-es'
import { formatDateShort, type FormatDateShortOptions } from '../lib/timeAgo'
import type { HTMLAttributes } from 'astro/types'
type Props = FormatDateShortOptions &
Omit<HTMLAttributes<'time'>, keyof FormatDateShortOptions | 'datetime'> & {
date: Date
}
const { date, ...props } = Astro.props
---
<time datetime={date.toISOString()} {...omit(props, 'prefix')}>{formatDateShort(date, props)}</time>