temporal-fns
API reference

endOfMonth

API index · Input types and conventions · Installation

endOfMonth(value) → same kind

Find the last date or final nanosecond of the containing month, including leap-day rules. Does not accept PlainYearMonth.

import { endOfMonth } from '@frantss/temporal-fns';

endOfMonth(Temporal.PlainDate.from('2024-02-01')).toString(); // => '2024-02-29'
endOfMonth(Temporal.PlainDate.from('2025-02-01')).toString(); // => '2025-02-28'
endOfMonth(Temporal.PlainDateTime.from('2026-10-23T14:30')).toString(); // => '2026-10-31T23:59:59.999999999'

Related: startOfMonth, eachMonthOfInterval, endOfQuarter.

Behaviors: BND-001: Plain date boundaries return complete dates; BND-002: Plain date-time boundaries retain nanosecond endpoint precision; BND-004: Month and quarter ends follow leap years and year boundaries; BND-010: Representable date ends do not require a representable period start.