MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getWeeksInMonth

Function getWeeksInMonth

packages/@internationalized/date/src/queries.ts:341–348  ·  view source on GitHub ↗
(
  date: DateValue,
  locale: string,
  firstDayOfWeek?: DayOfWeek
)

Source from the content-addressed store, hash-verified

339
340/** Returns the number of weeks in the given month and locale. */
341export function getWeeksInMonth(
342 date: DateValue,
343 locale: string,
344 firstDayOfWeek?: DayOfWeek
345): number {
346 let days = date.calendar.getDaysInMonth(date);
347 return Math.ceil((getDayOfWeek(startOfMonth(date), locale, firstDayOfWeek) + days) / 7);
348}
349
350/** Returns the lesser of the two provider dates. */
351export function minDate<A extends DateValue, B extends DateValue>(

Callers 2

getWeeksInMonthFunction · 0.90
queries.test.jsFile · 0.50

Calls 3

getDayOfWeekFunction · 0.85
startOfMonthFunction · 0.85
getDaysInMonthMethod · 0.65

Tested by

no test coverage detected