getDaysInMonth
The getDaysInMonth function calculates the number of days in a given month and year.
Usage Example
import { getDaysInMonth } from 'calendar-widgets';
const daysInFebruary = getDaysInMonth(2023, 2);
console.log(daysInFebruary); // Output: 28
Parameters
- Name
year
- Type
- number
- Description
- Name
month
- Type
- number
- Description
Return Value
The function returns an integer representing the number of days in the specified month and year.
Errors
The function throws an error if the year parameter is not a valid year between 1900 and 2100, or if the month parameter is not a valid month between 1 and 12.