Skip to content

Function: daysInMonth()

ts
function daysInMonth(date): number;

Number of days in the month of date (local calendar). 该日期所在自然月的天数(本地日历)。

Parameters

ParameterType
dateDate

Returns

number

Example

ts
daysInMonth(new Date(2026, 1, 1)) // 2026-02 → 28

Since

1.0.0

Released under the MIT License.