getDaysInMonth
function getDaysInMonth(date: Date): number;
Leap years are handled by the calendar itself, so February is 29 days where it should be. Only the month and the year of the date matter; the day and the time are ignored.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The date to read. It must be a valid |
Returns
number — the number of days, from 28 to 31.
Throws
Exception | Condition |
|---|---|
| an argument is not a valid |
Examples
Counting
getDaysInMonth(new Date(2026, 1, 10)); // => 28
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.