Skip to main content
Module

x/date_fns/index.js>setWeekYear

date-fns Deno package
Go to Latest
function setWeekYear
import { setWeekYear } from "https://deno.land/x/date_fns@v2.5.0/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