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

Function endOfISOWeekYear

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

Source from the content-addressed store, hash-verified

36 * //=> Sun Jan 01 2006 23:59:59.999
37 */
38export function endOfISOWeekYear<
39 DateType extends Date,
40 ResultDate extends Date = DateType,
41>(
42 date: DateArg<DateType>,
43 options?: EndOfISOWeekYearOptions<ResultDate> | undefined,
44): ResultDate {
45 const year = getISOWeekYear(date, options);
46 const fourthOfJanuaryOfNextYear = constructFrom(options?.in || date, 0);
47 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
48 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
49 const _date = startOfISOWeek(fourthOfJanuaryOfNextYear, options);
50 _date.setMilliseconds(_date.getMilliseconds() - 1);
51 return _date;
52}

Callers 1

test.tsFile · 0.90

Calls 3

getISOWeekYearFunction · 0.90
constructFromFunction · 0.90
startOfISOWeekFunction · 0.90

Tested by

no test coverage detected