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,3 +1,4 @@
import type { ContextFn, DateArg } from "./types.js";
/**
* @name constructNow
* @category Generic Helpers
@@ -11,8 +12,6 @@
*
* 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
@@ -21,13 +20,14 @@
* 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));
* }
*/
export declare function constructNow<DateType extends Date>(
date: DateType | number | string,
): DateType;
export declare function constructNow<
DateType extends Date,
ResultDate extends Date = DateType,
>(date: DateArg<DateType> | ContextFn<ResultDate> | undefined): ResultDate;