Skip to content

Function.daysInMonth

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / daysInMonth

Function: daysInMonth()

daysInMonth(date): number

Defined in: Date/daysInMonth.ts:12

Returns the number of days in the local-time month of the given date. Leap years follow the Gregorian calendar (February has 29 days).

Parameters

date

Date

Any date within the month

Returns

number

Number of days in that month (28-31), or NaN for an invalid date

Example

daysInMonth(new Date(2025, 0, 15)); // 31
daysInMonth(new Date(2024, 1, 1)); // 29
daysInMonth(new Date(2025, 1, 1)); // 28

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally