1 | import React from "react";
|
2 |
|
3 | import { subDays } from "date-fns";
|
4 | import { DayPicker, SelectSingleEventHandler } from "react-day-picker";
|
5 |
|
6 | export function ModifiersSelected() {
|
7 | const yesterday = subDays(new Date(), 1);
|
8 | const handleSelect: SelectSingleEventHandler = (value, date, modifiers) => {
|
9 | if (modifiers.selected) {
|
10 | alert("You clicked a selected day.");
|
11 | }
|
12 | if (modifiers.today) {
|
13 | alert("You clicked today");
|
14 | }
|
15 | };
|
16 | return (
|
17 | <DayPicker mode="single" selected={yesterday} onSelect={handleSelect} />
|
18 | );
|
19 | }
|