@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
16 lines • 905 B
TypeScript
import { Temporal } from "./temporal.js";
/**
* Return the 1-based calendar-grid week row that `dayInMonth` falls on for
* `firstOfMonth`'s month, given `firstDay` (locale first day of week,
* 1 = Monday .. 7 = Sunday).
*
* Shared by `getWeekOfMonth` (row for the date itself) and
* `getWeeksInMonth` (row for the month's last day, i.e. the row count).
* Week 1 is the row containing the 1st of the month, even when that row
* is a partial week: a month grid draws every day of the month, so its
* first row always holds the 1st. GMT's own rule; CLDR's `minDays` plays no part.
*
* Only the weekday of the 1st is read, so callers may pass `{ dayOfWeek }` without building a
* date that could lie before the representable range (April 1 of -271821).
*/
export declare function monthGridWeekRow(firstOfMonth: Pick<Temporal.PlainDate, "dayOfWeek">, firstDay: number, dayInMonth: number): number;