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,19 +1,14 @@
import type { ContextOptions, DateArg, MaybeArray } from "./types.js";
/**
* The {@link intlFormatDistance} function options.
*/
export interface IntlFormatDistanceOptions {
export interface IntlFormatDistanceOptions
extends Intl.RelativeTimeFormatOptions,
ContextOptions<Date> {
/** Force the distance unit */
unit?: IntlFormatDistanceUnit;
/** The locale(s) to use (see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument) */
locale?:
| Intl.UnicodeBCP47LocaleIdentifier
| Intl.UnicodeBCP47LocaleIdentifier[];
/** The locale matching algorithm to use. Other value: 'lookup'. See MDN for details [Locale identification and negotiation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation) */
localeMatcher?: Intl.RelativeTimeFormatLocaleMatcher;
/** The output message format. The values are 'auto' (e.g. `yesterday`), 'always'(e.g. `1 day ago`) */
numeric?: Intl.RelativeTimeFormatNumeric;
/** The length of the result. The values are: 'long' (e.g. `1 month`), 'short' (e.g. 'in 1 mo.'), 'narrow' (e.g. 'in 1 mo.'). The narrow one could be similar to the short one for some locales. */
style?: Intl.RelativeTimeFormatStyle;
/** The locales to use (see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument) */
locale?: MaybeArray<Intl.ResolvedDateTimeFormatOptions["locale"]>;
}
/**
* The unit used to format the distance in {@link intlFormatDistance}.
@@ -57,10 +52,8 @@ export type IntlFormatDistanceUnit =
* | 1 year | last year | next year |
* | 2+ years | X years ago | in X years |
*
* @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 date
* @param baseDate - The date to compare with.
* @param laterDate - The date
* @param earlierDate - The date to compare with.
* @param options - An object with options.
* See MDN for details [Locale identification and negotiation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* The narrow one could be similar to the short one for some locales.
@@ -126,8 +119,8 @@ export type IntlFormatDistanceUnit =
* )
* //=> 'in 2 yr'
*/
export declare function intlFormatDistance<DateType extends Date>(
date: DateType | number | string,
baseDate: DateType | number | string,
export declare function intlFormatDistance(
laterDate: DateArg<Date> & {},
earlierDate: DateArg<Date> & {},
options?: IntlFormatDistanceOptions,
): string;