API reference
endOfYear
API index · Input types and conventions · Installation
endOfYear(value) → same kind
Find December 31, or its final nanosecond, in the containing year. For PlainYearMonth, return December.
import { endOfYear } from '@frantss/temporal-fns';
endOfYear(Temporal.PlainDate.from('2024-02-29')).toString(); // => '2024-12-31'
endOfYear(Temporal.PlainYearMonth.from('2026-01')).toString(); // => '2026-12'
endOfYear(Temporal.PlainDateTime.from('2026-10-23T14:30')).toString(); // => '2026-12-31T23:59:59.999999999'Related: startOfYear, isSameYear, endOfQuarter.
Behaviors: BND-001: Plain date boundaries return complete dates; BND-002: Plain date-time boundaries retain nanosecond endpoint precision; BND-005: Year-month boundaries return months rather than invent days; BND-013: Unavailable required boundaries are rejected rather than clipped.