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,20 +1,23 @@
import { longFormatters } from "./_lib/format/longFormatters.js";
import type {
AdditionalTokensOptions,
ContextOptions,
DateArg,
FirstWeekContainsDateOptions,
LocalizedOptions,
WeekOptions,
} from "./types.js";
import { longFormatters } from "./_lib/format/longFormatters.js";
import { parsers } from "./parse/_lib/parsers.js";
export { longFormatters, parsers };
/**
* The {@link parse} function options.
*/
export interface ParseOptions
export interface ParseOptions<DateType extends Date = Date>
extends LocalizedOptions<"options" | "match" | "formatLong">,
FirstWeekContainsDateOptions,
WeekOptions,
AdditionalTokensOptions {}
AdditionalTokensOptions,
ContextOptions<DateType> {}
/**
* @name parse
* @category Common Helpers
@@ -200,7 +203,7 @@ export interface ParseOptions
*
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
*
* `parse` will try to match both formatting and stand-alone units interchangably.
* `parse` will try to match both formatting and stand-alone units interchangeably.
*
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
* the single quote characters (see below).
@@ -249,7 +252,7 @@ export interface ParseOptions
* 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
* 7. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
@@ -282,6 +285,7 @@ export interface ParseOptions
* Time value of Date: http://es5.github.io/#x15.9.1.1
*
* @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 ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
*
* @param dateStr - The string to parse
* @param formatStr - The string of tokens
@@ -312,9 +316,12 @@ export interface ParseOptions
* })
* //=> Sun Feb 28 2010 00:00:00
*/
export declare function parse<DateType extends Date>(
export declare function parse<
DateType extends Date,
ResultDate extends Date = DateType,
>(
dateStr: string,
formatStr: string,
referenceDate: DateType | number | string,
options?: ParseOptions,
): DateType;
referenceDate: DateArg<DateType>,
options?: ParseOptions<ResultDate>,
): ResultDate;