DatePicker'@ y0c / react-datepicker'默认值

时间:2019-11-11 16:22:08

标签: reactjs datepicker

我正在使用@y0c/react-datepicker中的DatePicker,我希望能够设置一个默认值,但是我不能,我已经设置了DefaultValue或选中了一个,但是没有一个显示该值,你有什么主意吗?

<Panel>
     <DatePicker onChange={onChange("DatePicker")} defaultValue='00/00/0000'/>
</Panel>

2 个答案:

答案 0 :(得分:1)

您需要包含dayjs,并且可以像

一样添加initialDate
<Panel>
  <DatePicker
    // to set default date
    initialDate={dayjs("2018-06-03")}
    onChange={onChange("DatePicker")}
    // to format date
    dateFormat="YYYY/MM/DD"
  />
</Panel>

答案 1 :(得分:0)

$query = "SELECT sc.*, dr.fullName, dr.email, dr.mobile, dr.address1, dr.town, dr.postCode, dr.utr, dr.vatNo, dr.driver_number, dr.pt, dr.siteLoc, dr.vatCharge, dr.vraRate, dr.third_party_provider
FROM scheduling sc
INNER JOIN driverReg dr ON dr.ni = sc.ni
WHERE sc.ref = '".$ref."' AND sc.excluded = 'No'";