Skip to content

@technobuddha > library > Time > Day

Function: occurrenceInMonth() ​

ts
function occurrenceInMonth(
   input: Date, 
   dayOfWeek: DayOfWeek, 
   occurrence: number | "last", 
   options: DateOptions): 
  | null
  | Date;

Defined in: occurrence-in-month.ts:18

Determine the date of an occurrence of a weekday within a month

Parameters ​

ParameterTypeDescription
inputDateA date within the month in question
dayOfWeekDayOfWeekThe day of the week to find the occurrence
occurrencenumber | "last"The occurrence number, or 'last' to find the last occurrence
optionsDateOptionssee DateOptions

Returns ​

| null | Date

A date object corresponding to the occurrence requested, or null if no such date exists in the month

Default Value ​

ts
utc false