1
0 Comments

I built an NPM package for filling in monthly calendar views

During the creation of my latest project, Gymbuddy.ai, I hit a roadblock when building the admin UI: calendars. I thought, "Oh, cool, grab this UI component, drop it in, and BAM!" But the first day of the month dropped into the Sunday slot and the whole calendar was off by about six days.

I investigated the issue and realized I would have to pad the calendar in order to get it to conform to a monthly calendar view (7x6 format). Even though most months have 31 days, calendars seem to have 42 slots per view.

I hope this helps someone who comes across this problem in the future. There's an open-source package called Calendar Filler that can be found at

https://www.npmjs.com/package/calendar-filler

and you can see the code at the link below

https://github.com/EvanBurbidge/calendar-filler

on March 15, 2023