@technobuddha/library
Version:
A large library of useful functions
25 lines (24 loc) • 909 B
TypeScript
import { type DayOfWeek } from './constants.ts';
/**
* Options for {@link getOccurrenceInMonth}
*
* @group Time
* @category Day
*/
export type GetOccurrenceInMonthOptions = {
/** Use the utc timezone */
utc?: boolean;
};
/**
* Determine the date of an occurrence of a weekday within a month
*
* @param input - A date within the month in question
* @param dayOfWeek - The day of the week to find the occurrence
* @param occurrence - The occurrence number, or 'last' to find the last occurrence
* @param options - see {@link GetOccurrenceInMonthOptions}
* @defaultValue utc false
* @returns A date object corresponding to the occurrence requested, or null if no such date exists in the month
* @group Time
* @category Day
*/
export declare function getOccurrenceInMonth(input: Date, dayOfWeek: DayOfWeek, occurrence: number | 'last', { utc }?: GetOccurrenceInMonthOptions): Date | null;