Created
July 25, 2020 16:25
-
-
Save jenil94/b33a090fb35bffc50950a7337b7be174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
import { | |
format, | |
startOfWeek, | |
addDays, | |
startOfMonth, | |
endOfMonth, | |
endOfWeek, | |
isSameMonth, | |
isSameDay, | |
subMonths, | |
addMonths | |
} from "date-fns"; | |
const Calendar = () => { | |
.... | |
const getHeader = () => { | |
return ( | |
<div class="header"> | |
<div | |
className="todayButton" | |
onClick={() => { | |
setSelectedDate(new Date()); | |
setActiveDate(new Date()); | |
}} | |
> | |
Today | |
</div> | |
<AiOutlineLeft | |
className="navIcon" | |
onClick={() => setActiveDate(subMonths(activeDate, 1))} | |
/> | |
<AiOutlineRight | |
className="navIcon" | |
onClick={() => setActiveDate(addMonths(activeDate, 1))} | |
/> | |
<h2 className="currentMonth">{format(activeDate, "MMMM yyyy")}</h2> | |
</div> | |
); | |
}; | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment