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,6 +1,4 @@
"use strict";
exports.constructNow = constructNow;
var _index = require("./constructFrom.js");
import { constructFrom } from "./constructFrom.js";
/**
* @name constructNow
@@ -15,8 +13,6 @@ var _index = require("./constructFrom.js");
*
* It defaults to `Date` if the passed reference date is a number or a string.
*
* @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 reference date to take constructor from
*
* @returns Current date initialized using the given date constructor
@@ -25,13 +21,16 @@ var _index = require("./constructFrom.js");
* import { constructNow, isSameDay } from 'date-fns'
*
* function isToday<DateType extends Date>(
* date: DateType | number | string,
* date: DateArg<DateType>,
* ): boolean {
* // If we were to use `new Date()` directly, the function would behave
* // differently in different timezones and return false for the same date.
* return isSameDay(date, constructNow(date));
* }
*/
function constructNow(date) {
return (0, _index.constructFrom)(date, Date.now());
export function constructNow(date) {
return constructFrom(date, Date.now());
}
// Fallback for modularized imports:
export default constructNow;