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,9 +1,10 @@
"use strict";
exports.intlFormat = intlFormat;
var _index = require("./toDate.js");
import { toDate } from "./toDate.js";
/**
* The locale string (see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
* @deprecated
*
* [TODO] Remove in v4
*/
/**
@@ -26,8 +27,6 @@ var _index = require("./toDate.js");
*
* > ⚠️ Please note that before Node version 13.0.0, only the locale data for en-US is available by default.
*
* @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 to format
*
* @returns The formatted date string
@@ -41,8 +40,6 @@ var _index = require("./toDate.js");
*/
/**
* @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 to format
* @param localeOptions - An object with locale
*
@@ -60,8 +57,6 @@ var _index = require("./toDate.js");
*/
/**
* @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 to format
* @param formatOptions - The format options
*
@@ -82,8 +77,6 @@ var _index = require("./toDate.js");
*/
/**
* @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 to format
* @param formatOptions - The format options
* @param localeOptions - An object with locale
@@ -106,7 +99,7 @@ var _index = require("./toDate.js");
* //=> Freitag, 4. Oktober 2019
*/
function intlFormat(date, formatOrLocale, localeOptions) {
export function intlFormat(date, formatOrLocale, localeOptions) {
let formatOptions;
if (isFormatOptions(formatOrLocale)) {
@@ -116,10 +109,13 @@ function intlFormat(date, formatOrLocale, localeOptions) {
}
return new Intl.DateTimeFormat(localeOptions?.locale, formatOptions).format(
(0, _index.toDate)(date),
toDate(date),
);
}
function isFormatOptions(opts) {
return opts !== undefined && !("locale" in opts);
}
// Fallback for modularized imports:
export default intlFormat;