import React from "react"; import { FieldProps } from "../../types"; import { FieldHelperText, LabelWithIcon } from "../components"; import { useCustomizationController } from "../../hooks"; import { getIconForProperty } from "../../util"; import { DateTimeField } from "@firecms/ui"; import { useClearRestoreValue } from "../useClearRestoreValue"; type DateTimeFieldProps = FieldProps; /** * Field that allows selecting a date * * This is one of the internal components that get mapped natively inside forms * and tables to the specified properties. * @group Form fields */ export function DateTimeFieldBinding({ propertyKey, value, setValue, autoFocus, error, showError, disabled, touched, property, includeDescription }: DateTimeFieldProps) { const { locale } = useCustomizationController(); const internalValue = value || null; useClearRestoreValue({ property, value, setValue }); return ( <> setValue(dateValue ?? null)} size={"medium"} mode={property.mode} clearable={property.clearable} locale={locale} error={showError} label={} /> ); }