I have an array of type Date. Any date that is in the array, I want the class "highlight" to be applied to it.
<Calendar
onChange={onChange}
value={value}
tileClassName={({ date }) => {
if (dates.find((x) => x.getTime() === date.getTime())) {
let highlight: string = "highlight";
return highlight;
}
}}
/>
date.getTime() will give you timestamp in milliseconds so there is very thin chance you will find equal values instead you can format the date for eg - "DD-MM-YYYY" then find the date.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.