MCPcopy
hub / github.com/date-fns/date-fns / lastDayOfISOWeekYear

Function lastDayOfISOWeekYear

pkgs/core/src/lastDayOfISOWeekYear/index.ts:38–53  ·  view source on GitHub ↗
(
  date: DateArg<DateType>,
  options?: LastDayOfISOWeekYearOptions<ResultDate> | undefined,
)

Source from the content-addressed store, hash-verified

36 * //=> Sun Jan 01 2006 00:00:00
37 */
38export function lastDayOfISOWeekYear<
39 DateType extends Date,
40 ResultDate extends Date = DateType,
41>(
42 date: DateArg<DateType>,
43 options?: LastDayOfISOWeekYearOptions<ResultDate> | undefined,
44): ResultDate {
45 const year = getISOWeekYear(date, options);
46 const fourthOfJanuary = constructFrom(options?.in || date, 0);
47 fourthOfJanuary.setFullYear(year + 1, 0, 4);
48 fourthOfJanuary.setHours(0, 0, 0, 0);
49
50 const date_ = startOfISOWeek(fourthOfJanuary, options);
51 date_.setDate(date_.getDate() - 1);
52 return date_;
53}

Callers 1

test.tsFile · 0.90

Calls 3

getISOWeekYearFunction · 0.90
constructFromFunction · 0.90
startOfISOWeekFunction · 0.90

Tested by

no test coverage detected