temporal-fns
API reference

getWeekOfMonth

API index · Input types and conventions · Installation

getWeekOfMonth(value, options?) → number

Return the 1-based row containing the date in a month calendar grid. The first row is the week intersecting the first of the month, even if that week began in the previous month. Accepts weekStartsOn; week-year anchor options do not apply.

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

getWeekOfMonth(Temporal.PlainDate.from('2026-05-01')); // => 1
getWeekOfMonth(Temporal.PlainDate.from('2026-05-03')); // => 2
getWeekOfMonth(Temporal.PlainDate.from('2026-05-31')); // => 6
getWeekOfMonth(Temporal.PlainDate.from('2026-05-31'), { weekStartsOn: 1 }); // => 5

Related: getWeeksInMonth, getWeek, eachWeekOfInterval.

Behaviors: CAL-008: Week-of-month counts intersecting grid rows; CAL-013: Every week-grid query validates its weekday boundary.