import dayjs from 'dayjs'; import { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps, GenericObjectType, } from '@rjsf/utils'; import DatePicker from 'antd/lib/date-picker'; const DATE_PICKER_STYLE = { width: '100%', }; /** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms * the value to undefined when it is falsy during the `onChange` handling. * * @param props - The `WidgetProps` for this component */ export default function DateWidget( props: WidgetProps ) { const { disabled, formContext, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props; const { readonlyAsDisabled = true } = formContext as GenericObjectType; const handleChange = (nextValue: any) => onChange(nextValue && nextValue.format('YYYY-MM-DD')); const handleBlur = () => onBlur(id, value); const handleFocus = () => onFocus(id, value); const getPopupContainer = (node: any) => node.parentNode; return ( (id)} /> ); }