(
date: DateArg<Date> & {},
options?: GetWeeksInMonthOptions | undefined,
)
| 40 | * //=> 6 |
| 41 | */ |
| 42 | export function getWeeksInMonth( |
| 43 | date: DateArg<Date> & {}, |
| 44 | options?: GetWeeksInMonthOptions | undefined, |
| 45 | ): number { |
| 46 | const contextDate = toDate(date, options?.in); |
| 47 | return ( |
| 48 | differenceInCalendarWeeks( |
| 49 | lastDayOfMonth(contextDate, options), |
| 50 | startOfMonth(contextDate, options), |
| 51 | options, |
| 52 | ) + 1 |
| 53 | ); |
| 54 | } |
no test coverage detected