registration
This commit is contained in:
30
frontend/style/node_modules/date-fns/getISOWeek.js
generated
vendored
30
frontend/style/node_modules/date-fns/getISOWeek.js
generated
vendored
@@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
exports.getISOWeek = getISOWeek;
|
||||
var _index = require("./constants.js");
|
||||
var _index2 = require("./startOfISOWeek.js");
|
||||
var _index3 = require("./startOfISOWeekYear.js");
|
||||
var _index4 = require("./toDate.js");
|
||||
import { millisecondsInWeek } from "./constants.js";
|
||||
import { startOfISOWeek } from "./startOfISOWeek.js";
|
||||
import { startOfISOWeekYear } from "./startOfISOWeekYear.js";
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link getISOWeek} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name getISOWeek
|
||||
@@ -15,9 +17,8 @@ var _index4 = require("./toDate.js");
|
||||
*
|
||||
* 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 given date
|
||||
* @param options - The options
|
||||
*
|
||||
* @returns The ISO week
|
||||
*
|
||||
@@ -26,14 +27,15 @@ var _index4 = require("./toDate.js");
|
||||
* const result = getISOWeek(new Date(2005, 0, 2))
|
||||
* //=> 53
|
||||
*/
|
||||
function getISOWeek(date) {
|
||||
const _date = (0, _index4.toDate)(date);
|
||||
const diff =
|
||||
+(0, _index2.startOfISOWeek)(_date) -
|
||||
+(0, _index3.startOfISOWeekYear)(_date);
|
||||
export function getISOWeek(date, options) {
|
||||
const _date = toDate(date, options?.in);
|
||||
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
||||
|
||||
// Round the number of weeks to the nearest integer because the number of
|
||||
// milliseconds in a week is not constant (e.g. it's different in the week of
|
||||
// the daylight saving time clock shift).
|
||||
return Math.round(diff / _index.millisecondsInWeek) + 1;
|
||||
return Math.round(diff / millisecondsInWeek) + 1;
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default getISOWeek;
|
||||
|
||||
Reference in New Issue
Block a user