registration

This commit is contained in:
User
2025-02-02 16:08:03 +03:00
parent 7f6495eb4d
commit 78afbaed71
6334 changed files with 196774 additions and 165754 deletions

View File

@@ -1,7 +1,9 @@
"use strict";
exports.getDaysInYear = getDaysInYear;
var _index = require("./isLeapYear.js");
var _index2 = require("./toDate.js");
import { isLeapYear } from "./isLeapYear.js";
import { toDate } from "./toDate.js";
/**
* The {@link getDaysInYear} function options.
*/
/**
* @name getDaysInYear
@@ -11,9 +13,8 @@ var _index2 = require("./toDate.js");
* @description
* Get the number of days in a year of 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).
*
* @param date - The given date
* @param options - An object with options
*
* @returns The number of days in a year
*
@@ -22,12 +23,11 @@ var _index2 = require("./toDate.js");
* const result = getDaysInYear(new Date(2012, 0, 1))
* //=> 366
*/
function getDaysInYear(date) {
const _date = (0, _index2.toDate)(date);
if (String(new Date(_date)) === "Invalid Date") {
return NaN;
}
return (0, _index.isLeapYear)(_date) ? 366 : 365;
export function getDaysInYear(date, options) {
const _date = toDate(date, options?.in);
if (Number.isNaN(+_date)) return NaN;
return isLeapYear(_date) ? 366 : 365;
}
// Fallback for modularized imports:
export default getDaysInYear;