import { startOfWeekYear } from "https://deno.land/x/date_fns@v2.5.1/index.js";
Examples
// The start of an a week-numbering year for 2 July 2005 with default settings:
var result = startOfWeekYear(new Date(2005, 6, 2))
//=> Sun Dec 26 2004 00:00:00
// The start of an a week-numbering year for 2 July 2005 with default settings: var result = startOfWeekYear(new Date(2005, 6, 2)) //=> Sun Dec 26 2004 00:00:00
// The start of a week-numbering year for 2 July 2005
// if Monday is the first day of week
// and 4 January is always in the first week of the year:
var result = startOfWeekYear(new Date(2005, 6, 2), {
weekStartsOn: 1,
firstWeekContainsDate: 4
})
//=> Mon Jan 03 2005 00:00:00
// The start of a week-numbering year for 2 July 2005 // if Monday is the first day of week // and 4 January is always in the first week of the year: var result = startOfWeekYear(new Date(2005, 6, 2), { weekStartsOn: 1, firstWeekContainsDate: 4 }) //=> Mon Jan 03 2005 00:00:00