Created
July 25, 2020 16:10
-
-
Save jenil94/b16e87206e212614c26799255cfa9ef6 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 } from "date-fns"; | |
const Calendar = () => { | |
.... | |
const getWeekDaysNames = () => { | |
const weekStartDate = startOfWeek(activeDate); | |
const weekDays = []; | |
for (let day = 0; day < 7; day++) { | |
weekDays.push( | |
<div className="day weekNames"> | |
{format(addDays(weekStartDate, day), "E")} | |
</div> | |
); | |
} | |
return <div className="weekContainer">{weekDays}</div>; | |
}; | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment