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,8 +1,5 @@
"use strict";
exports.formatDuration = formatDuration;
var _index = require("./_lib/defaultLocale.js");
var _index2 = require("./_lib/defaultOptions.js");
import { defaultLocale } from "./_lib/defaultLocale.js";
import { getDefaultOptions } from "./_lib/defaultOptions.js";
/**
* The {@link formatDuration} function options.
@@ -26,8 +23,6 @@ const defaultFormat = [
* @description
* Return human-readable duration string i.e. "9 months 2 days"
*
* @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 duration - The duration to format
* @param options - An object with options.
*
@@ -78,10 +73,9 @@ const defaultFormat = [
* formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' })
* //=> '2 years, 9 months, 3 weeks'
*/
function formatDuration(duration, options) {
const defaultOptions = (0, _index2.getDefaultOptions)();
const locale =
options?.locale ?? defaultOptions.locale ?? _index.defaultLocale;
export function formatDuration(duration, options) {
const defaultOptions = getDefaultOptions();
const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;
const format = options?.format ?? defaultFormat;
const zero = options?.zero ?? false;
const delimiter = options?.delimiter ?? " ";
@@ -103,3 +97,6 @@ function formatDuration(duration, options) {
return result;
}
// Fallback for modularized imports:
export default formatDuration;