diff --git a/components/editable/EditableDateTimeLocal.tsx b/components/editable/EditableDateTimeLocal.tsx index 40015f2..50412ec 100644 --- a/components/editable/EditableDateTimeLocal.tsx +++ b/components/editable/EditableDateTimeLocal.tsx @@ -1,5 +1,5 @@ import { HTMLProps } from "react"; -import { HumanDate } from "../HumanDate"; +import { FestaMoment } from "../extensions/FestaMoment"; import { Editable } from "./Editable"; export function EditableDateTimeLocal(props: HTMLProps & { value: Date }) { @@ -9,7 +9,7 @@ export function EditableDateTimeLocal(props: HTMLProps & { val } preview={ - + } /> ) diff --git a/components/HumanDate.tsx b/components/extensions/FestaMoment.tsx similarity index 56% rename from components/HumanDate.tsx rename to components/extensions/FestaMoment.tsx index 19f57bc..f81ceba 100644 --- a/components/HumanDate.tsx +++ b/components/extensions/FestaMoment.tsx @@ -4,11 +4,13 @@ type HumanDateProps = { date: Date } +/** + * Component that formats a {@link Date} to a machine-readable and human-readable HTML `time[datetime]` element. + */ +export function FestaMoment({ date }: HumanDateProps) { + const { t } = useTranslation() -export function HumanDate({date}: HumanDateProps) { - const {t} = useTranslation() - - if(Number.isNaN(date.getTime())) { + if (Number.isNaN(date.getTime())) { return ( {t("dateNaN")}