apps-script-utils 2.1.1 Help

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

date

Date

The date to read. It must be a valid Date.

Returns

number — the number of days, from 28 to 31.

Throws

Exception

Condition

IllegalArgumentException

an argument is not a valid Date.

Examples

Counting

getDaysInMonth(new Date(2026, 1, 10)); // => 28

See also

Source

src/time/getDaysInMonth.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.