Calendars
An excellent exercise is creating a calendar in JavaScript. Apart from the styling, it gives you a chance to practice looping and user-interactions such as changing the month and selecting a date or date range.
Sizing for Months
One of the interesting aspects of creating a calendar is how you have to account for the number of weeks you will need when rendering the whole month. Most of the time, you need five weeks, but occassionally you will need only four weeks or as many as six weeks, as shown in this comparison.
Short Month | Normal Month | Long Month |
---|---|---|
![]() | ![]() | ![]() |