API reference
isSameWeek
API index · Input types and conventions · Installation
isSameWeek(value, base, options?) → boolean
Check whether two values belong to the same containing week, even across a year boundary. weekStartsOn defaults to Sunday (0). Week numbering options do not apply.
import { isSameWeek } from '@frantss/temporal-fns';
const a = Temporal.PlainDate.from('2026-10-24');
const b = Temporal.PlainDate.from('2026-10-25');
isSameWeek(a, b); // => false
isSameWeek(a, b, { weekStartsOn: 1 }); // => true
isSameWeek(Temporal.PlainDate.from('2025-12-31'), Temporal.PlainDate.from('2026-01-01')); // => trueRelated: isSameISOWeek, startOfWeek, getWeek.
Behaviors: CMP-001: Period equality checks the period and its year; CMP-003: Week equality crosses a calendar-year boundary; CMP-005: Custom week starts change equality at the chosen boundary; CMP-010: Week equality can be decided without constructing an unavailable start.