DEV Community

Discussion on: Making a Calendar in Vanilla Javascript

Collapse
 
ddamato profile image
Donnie D'Amato

FYI, a single line to get the number of days in a month. new Date(year, month+1, 0).getDate(); where month represents a zero-indexed value for the month (January === 0, same as you are expecting above).