apps-script-utils 2.1.1 Help

getDaysLeftInMonth

function getDaysLeftInMonth(date: Date, inclusive: boolean = false): number;

The date itself is not counted: on the last day of a month the answer is 0. It is the number of days still to come, which is what a quota or a billing period usually wants.

Parameters

Parameter

Type

Description

date

Date

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

inclusive (optional) = false

boolean

Whether the given day counts towards the total.

Returns

number — the number of days left, 0 on the last day.

Throws

Exception

Condition

IllegalArgumentException

an argument is not a valid Date.

Examples

Counting

getDaysLeftInMonth(new Date(2026, 0, 20)); // => 11

See also

Source

src/time/getDaysLeftInMonth.ts

23 September 2026

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