diff --git a/node_modules/luxon/build/node/luxon.js b/node_modules/luxon/build/node/luxon.js index 3e54c8b..78205af 100644 --- a/node_modules/luxon/build/node/luxon.js +++ b/node_modules/luxon/build/node/luxon.js @@ -885,23 +885,14 @@ class PolyRelFormatter { style: "long", ...opts }; - if (!isEnglish && hasRelative()) { - this.rtf = getCachedRTF(intl, opts); - } + // force using Intl API for all languages + this.rtf = getCachedRTF(intl, opts); } format(count, unit) { - if (this.rtf) { - return this.rtf.format(count, unit); - } else { - return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); - } + return this.rtf.format(count, unit); } formatToParts(count, unit) { - if (this.rtf) { - return this.rtf.formatToParts(count, unit); - } else { - return []; - } + return this.rtf.formatToParts(count, unit); } } const fallbackWeekSettings = { @@ -5535,9 +5526,14 @@ function quickDT(obj, opts) { }); } function diffRelative(start, end, opts) { + // provide option to use Math.round as well as trunc + const roundingMethod = { + 'truncate': true, + 'round': false + } const round = isUndefined(opts.round) ? true : opts.round, format = (c, unit) => { - c = roundTo(c, round || opts.calendary ? 0 : 2, true); + c = roundTo(c, round || opts.calendary ? 0 : 2, roundingMethod[opts.roundingMethod ?? 'truncate']); const formatter = end.loc.clone(opts).relFormatter(opts); return formatter.format(c, unit); },