registration
This commit is contained in:
32
frontend/style/node_modules/date-fns/differenceInCalendarYears.js
generated
vendored
32
frontend/style/node_modules/date-fns/differenceInCalendarYears.js
generated
vendored
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
exports.differenceInCalendarYears = differenceInCalendarYears;
|
||||
var _index = require("./toDate.js");
|
||||
import { normalizeDates } from "./_lib/normalizeDates.js";
|
||||
|
||||
/**
|
||||
* The {@link differenceInCalendarYears} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name differenceInCalendarYears
|
||||
@@ -10,10 +12,9 @@ var _index = require("./toDate.js");
|
||||
* @description
|
||||
* Get the number of calendar years between the given dates.
|
||||
*
|
||||
* @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 dateLeft - The later date
|
||||
* @param dateRight - The earlier date
|
||||
* @param laterDate - The later date
|
||||
* @param earlierDate - The earlier date
|
||||
* @param options - An object with options
|
||||
|
||||
* @returns The number of calendar years
|
||||
*
|
||||
@@ -22,12 +23,17 @@ var _index = require("./toDate.js");
|
||||
* const result = differenceInCalendarYears(
|
||||
* new Date(2015, 1, 11),
|
||||
* new Date(2013, 11, 31)
|
||||
* )
|
||||
* );
|
||||
* //=> 2
|
||||
*/
|
||||
function differenceInCalendarYears(dateLeft, dateRight) {
|
||||
const _dateLeft = (0, _index.toDate)(dateLeft);
|
||||
const _dateRight = (0, _index.toDate)(dateRight);
|
||||
|
||||
return _dateLeft.getFullYear() - _dateRight.getFullYear();
|
||||
export function differenceInCalendarYears(laterDate, earlierDate, options) {
|
||||
const [laterDate_, earlierDate_] = normalizeDates(
|
||||
options?.in,
|
||||
laterDate,
|
||||
earlierDate,
|
||||
);
|
||||
return laterDate_.getFullYear() - earlierDate_.getFullYear();
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default differenceInCalendarYears;
|
||||
|
||||
Reference in New Issue
Block a user