API reference
isSameYear
API index · Input types and conventions · Installation
isSameYear(value, base, options?) → boolean
Check whether the represented calendar year matches. Also accepts PlainYearMonth.
import { isSameYear } from '@frantss/temporal-fns';
isSameYear(Temporal.PlainDate.from('2026-01-01'), Temporal.PlainDate.from('2026-12-31')); // => true
isSameYear(Temporal.PlainYearMonth.from('2026-01'), Temporal.PlainYearMonth.from('2026-12')); // => true
isSameYear(Temporal.PlainDate.from('2025-12-31'), Temporal.PlainDate.from('2026-01-01')); // => falseRelated: startOfYear, endOfYear, isSameQuarter.
Behaviors: CMP-001: Period equality checks the period and its year; CMP-002: Plain date-time comparisons ignore clocks; CMP-006: Partial months compare only at their supported precision; CMP-008: Different zoned inputs require a common viewing zone.