antd DatePicker不能选择当天过去时

377 阅读1分钟

antd DatePicker不能选择当天过去时


   <DatePicker
    showTime
    disabledDate={(current) => {
      return current && current < moment().subtract(1, 'days')
    }}
    disabledTime={(date: any) => {
      return {
        disabledHours: () =>
          new Date(date).getDate() === new Date().getDate()
            ? range(0, 24).splice(0, new Date().getHours() + 1)
            : [],
        disabledMinutes: () => [],
        disabledSeconds: () => [],
      }
    }}
    disabled={!enbleRemindTime}
    onChange={(e) => {
      console.log(e)
    }}
   />

image.png