我该怎么做才能突出显示三个特定日期?

How can I do to highlight three specific dates?

我试图使用 React.js 和 Datepicker 突出显示三个特定日期:“10-11-2020”、“22-11-2020”、“07-11-2020”,但我没有做到这一点。这是我的代码:

import React, {useState, Component} from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

const Datepicker = (props) => {
  const [startDate, setStartDate] = useState(new Date());
 
  return (
    <DatePicker
      className="custom-select"
      dateFormat="dd/MM/yyyy"
      selected={startDate}
      highlightDates={["10-11-2020","22-11-2020", "07-11-2020"]}
    />
  );
};

export default Datepicker;

我把我的代码放在这里:https://codesandbox.io/s/unruffled-wescoff-mfpgj?file=/src/App.js

你能帮帮我吗?

您必须将 javascript 日期对象数组传递给 highlightDates

<DatePicker
    .....
    highlightDates={[new Date("2020-11-15"), new Date("2020-11-20")]} //This should be js date array
/>

Updated demo