Ant Design - How can I disable a specific hour/minute in a rangepicker based on the date?

77 Views Asked by At

I have a rangepicker:

<RangePicker
   changeOnBlur={true}
   onChange={horas}
   disabledDate={datasImp}
   disabledTime={horasImp}
   placeholder={["Begin", "End"]}
   showTime={{format:'HH:mm'}} 
   format="DD/MM/YYYY HH:mm"
/>
const horasImp = () => {
   return {
      disabledHours: () => {
         //disabled hours before now
         return [...range(0, 6), ...range(23, 24)]
      }, 
      disabledMinutes: (hour) => {
         //disabled minutes before now
         if(hour == dayjs().hour()){
                    return range(0, dayjs().minute())
         }
         else if(hour == 22){
            return range(31,60)
         }
         else{
            return []
         }
      },
            
   };
}
const datasImp = (current) => {return current && current < dayjs().subtract(1, 'day')}

My disabledDate and disabledTime are working well, but I want to disable a specific time based on the date. Or in other words, I want to get the current date while I am on the disabledMinutes/disabledHours. How can I do this?

0

There are 0 best solutions below