# 6045 MINCalendar
# 60
45 MIN
Overview
Implement a working month calendar in App.tsx — the calendar components are provided, so you focus on rendering the correct days, highlighting today, navigating between months, and handling leap years with plain JavaScript date math.
Requirements
- Render the app title "Calendar" and the weekday header (
MonthroughSun). - Show the current month and year in the header (e.g.
August 2026). - Render the correct number of days for the selected month (28, 29, 30, or 31).
- Place the 1st day of the month in the correct weekday column.
- Fill the empty cells with days from the previous and next month so the grid always completes full weeks, dimming those days visually.
- Navigate to the previous month.
- Navigate to the next month.
- Highlight the current day (today) in the grid.
- Change the year correctly when navigating past December or before January.
- Handle leap years correctly (February has 29 days in a leap year and 28 otherwise).
Notes
Components.tsxis read-only — components, props, anddata-testidattributes are already wired. Implement everything inApp.tsx.- Day
0of a month is the last day of the previous month, sonew Date(year, month + 1, 0).getDate()returns the number of days inmonth(leap years included). new Date(year, month, 1).getDay()returns the weekday of the 1st (0 = Sunday). The week starts on Monday, so the leading-day offset is(getDay() + 6) % 7.- Navigate with
new Date(year, month + offset, 1)— JavaScript rolls the year over automatically. - Use
new Date()for the initial month and to flag today's date.
Tests
- renders the app title
- renders the seven weekday labels
- shows the current month and year in the header
- renders the correct number of days for the current month
- places the 1st day on the correct weekday
- fills the grid with days from the previous and next month
- navigates to the next month
- navigates to the previous month
- changes the year when navigating past December
- changes the year when navigating before January
- highlights today's date
- does not highlight any day when viewing another month
- renders 28 days for February in a non-leap year
- renders 29 days for February in a leap year
- renders 30 days for a 30-day month
- uses five weeks when the month fits in five