update cloudflare context

This commit is contained in:
2025-12-17 23:52:08 -03:00
parent d683feb85f
commit be1ae656d3
25 changed files with 222 additions and 94 deletions

View File

@@ -0,0 +1,33 @@
import type { ComponentPropsWithoutRef } from 'react'
type DateTimeProps = {
children: string
options?: Intl.DateTimeFormatOptions
locale?: string
} & ComponentPropsWithoutRef<'time'>
export function DateTime({
children,
options,
locale = 'pt-BR',
...props
}: DateTimeProps) {
const optionsInit: Intl.DateTimeFormatOptions = {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit'
}
const datetime = new Intl.DateTimeFormat(locale, {
...optionsInit,
...options
})
return (
<time dateTime={children} {...props}>
{datetime.format(new Date(children))}
</time>
)
}