Temporal input components added

This commit is contained in:
2025-07-31 22:23:00 -04:00
parent f6f77c9d42
commit e1b3000121
8 changed files with 118 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
import type { DateInputProps } from "$/types/Input";
import clsx from "clsx";
import moment from "moment";
export default function DateInput({
id,
className,
defaultValue,
value,
onChange
}: DateInputProps){
return (
<input
type="date"
id={id}
className={clsx(
"border rounded-lg px-2 py-1",
className
)}
defaultValue={defaultValue ? moment(defaultValue).format("YYYY-MM-DD") : undefined}
value={value ? moment(value).format("YYYY-MM-DD") : undefined}
onChange={(e) => onChange?.(new Date(moment(e.target.value, "YYYY-MM-DD").toDate()))}
/>
);
}