I have added datepicker of antd in antd form and added disabledTime props and added props value to disabled the future time from current when today’s date is selected, but because i think it checking time at every second my scrollbar resetting automatically but in 5.0.0 and older version of antd is it working fine, and one more thing when I select today’s date it is automatically selecting the current time but in the new version it is not selecting, it is showing 00:00
This is my code in react project with antd form field
<FormItem
name={"incident_time_1"}
rules={[
{
required: true,
message: "Please enter incident time",
},
]}
{...formItemLayout}
label='Incident Date Time'
>
<DatePicker
format={"YYYY/MM/DD HH:mm"}
showTime
disabledTime={(current) => {
if (!current) return {};
const now = dayjs();
if (current.isSame(now, "day")) {
return {
disabledHours: () =>
Array.from({ length: 24 }, (_, i) => i).filter(
(hour) => hour > now.hour()
),
};
}
return {};
}}
disabledDate={(current) =>
current && current > dayjs().endOf("day")
}
onChange={(value) =>
form.setFieldsValue({ incident_time_2: value })
}
/>
</FormItem>