mirror of
https://github.com/Steffo99/festa.git
synced 2025-01-03 12:34:20 +00:00
Rename HumanDate to FestaMoment
This commit is contained in:
parent
e70d50928b
commit
a67ab81541
2 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { HTMLProps } from "react";
|
import { HTMLProps } from "react";
|
||||||
import { HumanDate } from "../HumanDate";
|
import { FestaMoment } from "../extensions/FestaMoment";
|
||||||
import { Editable } from "./Editable";
|
import { Editable } from "./Editable";
|
||||||
|
|
||||||
export function EditableDateTimeLocal(props: HTMLProps<HTMLInputElement> & { value: Date }) {
|
export function EditableDateTimeLocal(props: HTMLProps<HTMLInputElement> & { value: Date }) {
|
||||||
|
@ -9,7 +9,7 @@ export function EditableDateTimeLocal(props: HTMLProps<HTMLInputElement> & { val
|
||||||
<input type="datetime-local" {...props} value={props.value.toISOString()} />
|
<input type="datetime-local" {...props} value={props.value.toISOString()} />
|
||||||
}
|
}
|
||||||
preview={
|
preview={
|
||||||
<HumanDate date={props.value} />
|
<FestaMoment date={props.value} />
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,11 +4,13 @@ type HumanDateProps = {
|
||||||
date: Date
|
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) {
|
if (Number.isNaN(date.getTime())) {
|
||||||
const {t} = useTranslation()
|
|
||||||
|
|
||||||
if(Number.isNaN(date.getTime())) {
|
|
||||||
return (
|
return (
|
||||||
<span className="disabled">
|
<span className="disabled">
|
||||||
{t("dateNaN")}
|
{t("dateNaN")}
|
Loading…
Reference in a new issue