Files
url_tracker_tool/node_modules/date-fns/endOfISOWeekYear.js
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

39 lines
1.4 KiB
JavaScript

"use strict";
exports.endOfISOWeekYear = endOfISOWeekYear;
var _index = require("./getISOWeekYear.js");
var _index2 = require("./startOfISOWeek.js");
var _index3 = require("./constructFrom.js");
/**
* @name endOfISOWeekYear
* @category ISO Week-Numbering Year Helpers
* @summary Return the end of an ISO week-numbering year for the given date.
*
* @description
* Return the end of an ISO week-numbering year,
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The end of an ISO week-numbering year
*
* @example
* // The end of an ISO week-numbering year for 2 July 2005:
* const result = endOfISOWeekYear(new Date(2005, 6, 2))
* //=> Sun Jan 01 2006 23:59:59.999
*/
function endOfISOWeekYear(date) {
const year = (0, _index.getISOWeekYear)(date);
const fourthOfJanuaryOfNextYear = (0, _index3.constructFrom)(date, 0);
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
const _date = (0, _index2.startOfISOWeek)(fourthOfJanuaryOfNextYear);
_date.setMilliseconds(_date.getMilliseconds() - 1);
return _date;
}