Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为“日历”提供的“字符串”类型的“选定”属性无效,应为“日期”实例?_Javascript_Reactjs_Redux_Datepicker - Fatal编程技术网

Javascript 为“日历”提供的“字符串”类型的“选定”属性无效,应为“日期”实例?

Javascript 为“日历”提供的“字符串”类型的“选定”属性无效,应为“日期”实例?,javascript,reactjs,redux,datepicker,Javascript,Reactjs,Redux,Datepicker,我在react js中使用日期选择器 但是我的当前值为空null。现在我想在我聚焦到输入字段时显示日期选择器。但我收到错误/警告,这是为什么 proxyConsole.js:72 Warning: Failed prop type: Invalid prop `selected` of type `String` supplied to `Calendar`, expected instance of `Date`. in Calendar (created by OnClickOuts

我在react js中使用日期选择器 但是我的当前值为空
null
。现在我想在我聚焦到
输入字段时显示日期选择器。但我收到错误/警告,这是为什么

proxyConsole.js:72 Warning: Failed prop type: Invalid prop `selected` of type `String` supplied to `Calendar`, expected instance of `Date`.
    in Calendar (created by OnClickOutside(Calendar))
    in OnClickOutside(Calendar) (created by DatePicker)
    in div (created by InnerPopper)
    in InnerPopper (created by Context.Consumer)
    in Popper (created by PopperComponent)
    in Manager (created by PopperComponent)
    in PopperComponent (created by DatePicker)
    in DatePicker (created by Main)
实际上,我在转换数据时添加了一个条件

 data[i].displaytext = i;
        if (data[i].dataType === "DATE" && data[i].value) {
          data[i].value = new Date(data[i].value);
        }
        obj[lastLabel] = [...obj[lastLabel], data[i]];
      }
这是我的密码


请帮助我删除此警告

它看起来像
DOB
对象中的默认
是一个字符串,但您将其传递给的组件需要一个
日期
。看起来好像变了

DOB: {
    value: "",
    type: "FIELD",
    editable: true,
    dataType: "DATE",
    required: true,
    displayName: null,
    pattern: null
}

DOB:{
值:null//
DOB: {
    value: null, // <- specifically this line
    type: "FIELD",
    editable: true,
    dataType: "DATE",
    required: true,
    displayName: null,
    pattern: null
}