[JavaScript]Return Number Of Days For Month Input

This recipe demonstrates how to determine the number of days in a month using JavaScript.

How does this function work? It is quite simple. When the Date() function is given a day number that is greater than the number of days in the given month of the given year, it wraps the date into the next month. The getDate() function returns the day of the month, starting from the beginning of the month that the date is in. So, day 32 of March is considered to be day 1 of April. Subtracting 1 from 32 gives the correct number of days in March.

To download the necessary files for this recipe, refer to the attached ZIP file.
ReturnNumberofDaysForMonthInput.zip (2.7 KB)