registration
This commit is contained in:
26
frontend/style/node_modules/date-fns/getWeek.js
generated
vendored
26
frontend/style/node_modules/date-fns/getWeek.js
generated
vendored
@@ -1,9 +1,7 @@
|
||||
"use strict";
|
||||
exports.getWeek = getWeek;
|
||||
var _index = require("./constants.js");
|
||||
var _index2 = require("./startOfWeek.js");
|
||||
var _index3 = require("./startOfWeekYear.js");
|
||||
var _index4 = require("./toDate.js");
|
||||
import { millisecondsInWeek } from "./constants.js";
|
||||
import { startOfWeek } from "./startOfWeek.js";
|
||||
import { startOfWeekYear } from "./startOfWeekYear.js";
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link getWeek} function options.
|
||||
@@ -23,8 +21,6 @@ var _index4 = require("./toDate.js");
|
||||
*
|
||||
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
||||
*
|
||||
* @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 - An object with options
|
||||
*
|
||||
@@ -45,15 +41,15 @@ var _index4 = require("./toDate.js");
|
||||
* })
|
||||
* //=> 53
|
||||
*/
|
||||
|
||||
function getWeek(date, options) {
|
||||
const _date = (0, _index4.toDate)(date);
|
||||
const diff =
|
||||
+(0, _index2.startOfWeek)(_date, options) -
|
||||
+(0, _index3.startOfWeekYear)(_date, options);
|
||||
export function getWeek(date, options) {
|
||||
const _date = toDate(date, options?.in);
|
||||
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
||||
|
||||
// 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 getWeek;
|
||||
|
||||
Reference in New Issue
Block a user