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

Function getWeeksInMonth

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

Source from the content-addressed store, hash-verified

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

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