MCPcopy
hub / github.com/date-fns/date-fns / getWeeksInMonth

Function getWeeksInMonth

pkgs/core/src/getWeeksInMonth/index.ts:42–54  ·  view source on GitHub ↗
(
  date: DateArg<Date> & {},
  options?: GetWeeksInMonthOptions | undefined,
)

Source from the content-addressed store, hash-verified

40 * //=> 6
41 */
42export 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}

Callers 3

test.tsFile · 0.90
_testFunction · 0.90
test.tsFile · 0.90

Calls 4

toDateFunction · 0.90
lastDayOfMonthFunction · 0.90
startOfMonthFunction · 0.90

Tested by

no test coverage detected