Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.0.0-beta.4/setWeekYear/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, // 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

Parameters

dirtyDate
  • the date to be changed
dirtyWeekYear
  • the local week-numbering year of the new date
dirtyOptions