Reactjs React中物料UI日期选择器中的最小和最大日期

Reactjs React中物料UI日期选择器中的最小和最大日期,reactjs,material-ui,react-hooks,react-material,Reactjs,Material Ui,React Hooks,React Material,我有一个条件,如果access值为1,则选择日期没有限制。但是,如果access的值不是1,则只能选择今天。我的问题是,即使access的值为1,我也无法选择其他月份。我只能在一个月内选择。我怎样才能解决这个问题 请在这里查看我的代码 <KeyboardDatePicker minDate={access !== 1 ? new Date() : ""} maxDate={access !== 1 ? new Date() : ""} f

我有一个条件,如果
access
值为1,则选择日期没有限制。但是,如果
access
的值不是1,则只能选择今天。我的问题是,即使
access
的值为1,我也无法选择其他月份。我只能在一个月内选择。我怎样才能解决这个问题

请在这里查看我的代码

<KeyboardDatePicker
  minDate={access !== 1 ? new Date() : ""}
  maxDate={access !== 1 ? new Date() : ""}
  fullWidth
  InputLabelProps={{ shrink: true }}
  inputVariant="outlined"
  id="date-picker-dialog"
  label="Select Date"
  format="MM/dd/yyyy"
  clearable
  value={values.start_date}
  onChange={(val) => {
    setFieldValue("start_date", val);
  }}
  onBlur={handleBlur}
  helperText={touched.start_date ? errors.start_date : ""}
  error={touched.start_date && Boolean(errors.start_date)}
  TextFieldComponent={TextFieldComponent}
/>;
{
setFieldValue(“开始日期”,val);
}}
onBlur={handleBlur}
helperText={toucted.start_date?errors.start_date:}
错误={toucted.start\u date&&Boolean(errors.start\u date)}
TextFieldComponent={TextFieldComponent}
/>;

如果不想添加最小/最大约束,请使用
未定义
而不是空字符串


现场演示

谢谢。“你也认识福米克吗?”约瑟夫是我个人使用的。如果你有任何问题,你可以随时问另一个问题。我有,请检查这个你可以在这里获得更多信息@约瑟夫