Skip to main content
The Deno 2 Release Candidate is here
Learn more
Very Popular
Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.22.1/getWeeksInMonth/index.ts";

Examples

// How many calendar weeks does February 2015 span? const result = getWeeksInMonth(new Date(2015, 1, 8)) //=> 4

// If the week starts on Monday, // how many calendar weeks does July 2017 span? const result = getWeeksInMonth(new Date(2017, 6, 5), { weekStartsOn: 1 }) //=> 6

Parameters

date: Date | number
  • the given date
optional
options: LocaleOptions & WeekStartOptions

Returns

number

the number of calendar weeks