import { setWeekYear } from "https://deno.land/x/date_fns@v2.0.0-alpha.34/index.js";
Examples
// Set the local week-numbering year 2004 to 2 January 2010 with default options:
var result = setWeekYear(new Date(2010, 0, 2), 2004)
//=> Sat Jan 03 2004 00:00:00
// Set the local week-numbering year 2004 to 2 January 2010 with default options: var result = setWeekYear(new Date(2010, 0, 2), 2004) //=> Sat Jan 03 2004 00:00:00
// Set the local week-numbering year 2004 to 2 January 2010,
// if Monday is the first day of week
// and 4 January is always in the first week of the year:
var result = setWeekYear(new Date(2010, 0, 2), 2004, {
weekStartsOn: 1,
firstWeekContainsDate: 4
})
//=> Sat Jan 01 2005 00:00:00
// Set the local week-numbering year 2004 to 2 January 2010, // if Monday is the first day of week // and 4 January is always in the first week of the year: var result = setWeekYear(new Date(2010, 0, 2), 2004, { weekStartsOn: 1, firstWeekContainsDate: 4 }) //=> Sat Jan 01 2005 00:00:00