UNPKG

972 BTypeScriptView Raw
1import type { LocalizedOptions, WeekOptions } from "./types.js";
2/**
3 * The {@link getWeekOfMonth} function options.
4 */
5export interface GetWeekOfMonthOptions
6 extends LocalizedOptions<"options">,
7 WeekOptions {}
8/**
9 * @name getWeekOfMonth
10 * @category Week Helpers
11 * @summary Get the week of the month of the given date.
12 *
13 * @description
14 * Get the week of the month of the given date.
15 *
16 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
17 *
18 * @param date - The given date
19 * @param options - An object with options.
20 *
21 * @returns The week of month
22 *
23 * @example
24 * // Which week of the month is 9 November 2017?
25 * const result = getWeekOfMonth(new Date(2017, 10, 9))
26 * //=> 2
27 */
28export declare function getWeekOfMonth<DateType extends Date>(
29 date: DateType | number | string,
30 options?: GetWeekOfMonthOptions,
31): number;