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

Examples

// Are 31 August 2014 and 4 September 2014 in the same week? var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4)) //=> true

// If week starts with Monday, // are 31 August 2014 and 4 September 2014 in the same week? var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), { weekStartsOn: 1 }) //=> false

Parameters

dirtyDateLeft: Date | number
  • the first date to check
dirtyDateRight: Date | number
  • the second date to check
optional
dirtyOptions: LocaleOptions & WeekStartOptions

Returns

boolean

the dates are in the same week