1.0.1 • Published 1 month ago
@288-toolkit/html-time v1.0.1
Html-time
pnpm i @288-toolkit/html-time
A convenient wrapper component arund the html element.
Props
date
(Date
): The date to displayformatOptions
(FormatDateOptions
): The date formatting options (see format package)
Slot props
formattedDate
(string
): The formatted date
Examples
<Time
date={new Date('2023-04-17T21:34:50.360Z')}
formatOptions={{ day: 'numeric', month: 'long', year: 'numeric' }}
/>
<Time
date={new Date('2023-04-17T21:34:50.360Z')}
formatOptions={{ day: 'numeric', month: 'long' }}
let:formattedDate
>
<span class="text-[red]">
{formattedDate}
</span>
</Time>