temporal-fns
API reference

startOfWeek

API index · Input types and conventions · Installation

startOfWeek(value, options?) → same kind

Find the start of the containing seven-date week. Set weekStartsOn to change its first weekday; this is independent of business-day weekend configuration.

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

const date = Temporal.PlainDate.from('2026-10-23');
startOfWeek(date).toString(); // => '2026-10-18'
startOfWeek(date, { weekStartsOn: 1 }).toString(); // => '2026-10-19'
startOfWeek(Temporal.PlainDateTime.from('2026-10-23T14:30')).toString(); // => '2026-10-18T00:00:00'

Related: endOfWeek, startOfISOWeek, eachWeekOfInterval.

Behaviors: BND-001: Plain date boundaries return complete dates; BND-002: Plain date-time boundaries retain nanosecond endpoint precision; BND-003: Week configuration changes starts and ends together; BND-008: A skipped midnight produces the earliest valid start.