registration
This commit is contained in:
24
frontend/style/node_modules/date-fns/lastDayOfDecade.js
generated
vendored
24
frontend/style/node_modules/date-fns/lastDayOfDecade.js
generated
vendored
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
exports.lastDayOfDecade = lastDayOfDecade;
|
||||
var _index = require("./toDate.js");
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link lastDayOfDecade} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name lastDayOfDecade
|
||||
@@ -10,9 +12,11 @@ var _index = require("./toDate.js");
|
||||
* @description
|
||||
* Return the last day of a decade for the given 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).
|
||||
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows using extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
||||
* @typeParam ResultDate - The result `Date` type; inferred from arguments or specified by context.
|
||||
*
|
||||
* @param date - The original date
|
||||
* @param options - The options
|
||||
*
|
||||
* @returns The last day of a decade
|
||||
*
|
||||
@@ -21,14 +25,14 @@ var _index = require("./toDate.js");
|
||||
* const result = lastDayOfDecade(new Date(2012, 11, 21, 21, 12, 00))
|
||||
* //=> Wed Dec 31 2019 00:00:00
|
||||
*/
|
||||
function lastDayOfDecade(date) {
|
||||
// TODO: Switch to more technical definition in of decades that start with 1
|
||||
// end with 0. I.e. 2001-2010 instead of current 2000-2009. It's a breaking
|
||||
// change, so it can only be done in 4.0.
|
||||
const _date = (0, _index.toDate)(date);
|
||||
export function lastDayOfDecade(date, options) {
|
||||
const _date = toDate(date, options?.in);
|
||||
const year = _date.getFullYear();
|
||||
const decade = 9 + Math.floor(year / 10) * 10;
|
||||
_date.setFullYear(decade + 1, 0, 0);
|
||||
_date.setHours(0, 0, 0, 0);
|
||||
return _date;
|
||||
return toDate(_date, options?.in);
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default lastDayOfDecade;
|
||||
|
||||
Reference in New Issue
Block a user