javascript-time-ago 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -243,12 +243,15 @@ var TimeAgo = exports["default"] = /*#__PURE__*/function () {
243
243
  // when the delay is longer than about `24.85` days.
244
244
  // https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values
245
245
  //
246
- // To not burden the end user of this library with manually working around that bug,
247
- // this library automatically caps the returned delay to a maximum value that
248
- // still works with `setTimeout()` and doesn't break it.
246
+ // In order to not burden the end users of this library with manually working around that bug,
247
+ // this library automatically caps the returned delay to a maximum value of about `24.85` days
248
+ // which still works correctly with `setTimeout()` function and doesn't break it.
249
249
  //
250
- // The end user of this library could still opt out of this auto-workaround feature
251
- // by passing a `getTimeToNextUpdateUncapped: true` option.
250
+ // The end user of this library could still disable this automatic workaround
251
+ // by passing a `getTimeToNextUpdateUncapped: true` parameter.
252
+ // In that case, it will return the original non-modified uncapped delay
253
+ // which can be longer than `24.85` days and should be manually capped
254
+ // by the developer if it's going to be used in a `setTimeout()` call.
252
255
  //
253
256
  if (options.getTimeToNextUpdateUncapped) {
254
257
  return timeToNextUpdate;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeAgo.js","names":["_relativeTimeFormat","_interopRequireDefault","require","_cache","_locale","_isStyleObject","_getStep3","_getStepDenominator","_getTimeToNextUpdate","_LocaleDataStore","_roundMinute","_getStyleByName","_round","e","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_createForOfIteratorHelperLoose","r","t","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","done","value","TypeError","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_nonIterableRest","a","_arrayLikeToArray","toString","slice","name","from","test","n","l","i","u","f","Object","push","_classCallCheck","_defineProperties","enumerable","configurable","writable","defineProperty","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","TimeAgo","exports","locales","arguments","undefined","_ref","polyfill","locale","chooseLocale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","format","input","style","options","_this","isStyle","defaultStyle","getStyleByName","timestamp","getTimestamp","_this$getLabels","getLabels","flavour","labels","labelsType","round","now","nowRealWhenCalled","Date","getTextAndTextRefreshDelayGetterFunctions","_ref2","secondsPassed","future","nowLabel","getNowLabel","custom","text","date","time","elapsed","getText","getTextRefreshDelay","Error","units","getTimeIntervalMeasurementUnits","_getStep","getStep","gradation","steps","getNextStep","_getStep2","prevStep","step","nextStep","formatDateForStep","timeToNextUpdate","getTimeToNextUpdate","getTimeToNextUpdateUncapped","getSafeTimeoutDelay","_getTextAndTextRefres","refresh","defaultRefreshInterval","refreshTimer","scheduleRefresh","delay","setTimeoutSafe","_getTextAndTextRefres2","stopRefreshing","clearTimeout","_ref3","_this2","formatAs","unit","amount","formatValue","JSON","stringify","Math","abs","getStepDenominator","granularity","getRoundFunction","valueForFormatting","sign","getFormatter","_ref4","getFormattingRule","replace","formatNumber","formattingRules","_ref5","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","get","put","map","localeData","_iterator","_step","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","warn","addLocale","addLocaleData","addLabels","isMockedDate","getTime","object","allowedUnits","keys","filter","indexOf","nowLabels","longLabels","past","second","current","variable","isStyleObject","func","setTimeout","min","SET_TIMEOUT_MAX_SAFE_DELAY"],"sources":["../source/TimeAgo.js"],"sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache.js'\r\nimport chooseLocale from './locale.js'\r\nimport isStyleObject from './isStyleObject.js'\r\n\r\nimport getStep from './steps/getStep.js'\r\nimport getStepDenominator from './steps/getStepDenominator.js'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate.js'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore.js'\r\n\r\nimport defaultStyle from './style/roundMinute.js'\r\nimport getStyleByName from './style/getStyleByName.js'\r\n\r\nimport { getRoundFunction } from './round.js'\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {(number|Date)} input — A `Date` or a javascript timestamp.\r\n\t *\r\n\t * @param {(string|object)} style — Date/time formatting style. Either one of the built-in style names or a \"custom\" style definition object having `steps: object[]` and `labels: string[]`.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdateUncapped] — Pass `true` to not apply the workaround for `setTimeout()` bug. https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t *\r\n\t * @param {function} [options.refresh] — When `refresh` function is passed, it will be automatically called with a new text when it's time to refresh the label.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\t// `round` setting could be passed as a parameter to `.format()` function\r\n\t\t// or be configured globally for a style.\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// A developer can pass a custom `now`, e.g. for testing purposes.\r\n\t\tlet now\r\n\t\tconst nowRealWhenCalled = Date.now()\r\n\t\t// (deprecated)\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// One could pass `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\t// The default `now` is `Date.now()`.\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = nowRealWhenCalled\r\n\t\t}\r\n\r\n\t\tconst getTextAndTextRefreshDelayGetterFunctions = ({ now }) => {\r\n\t\t\t// how much time has passed (in seconds)\r\n\t\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\t\tconst nowLabel = getNowLabel(\r\n\t\t\t\tlabels,\r\n\t\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\t\tfuture\r\n\t\t\t)\r\n\r\n\t\t\t// (deprecated)\r\n\t\t\t//\r\n\t\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t\t//\r\n\t\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t\t// This feature is currently not used anywhere and is here\r\n\t\t\t// just for providing the ultimate customization point\r\n\t\t\t// in case anyone would ever need that. Prefer using\r\n\t\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t\t//\r\n\t\t\tif (style.custom) {\r\n\t\t\t\tconst text = style.custom({\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\t\ttime: timestamp,\r\n\t\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\t\tlocale: this.locale\r\n\t\t\t\t})\r\n\t\t\t\tif (text !== undefined) {\r\n\t\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tgetText: () => text,\r\n\t\t\t\t\t\tgetTextRefreshDelay: () => {\r\n\t\t\t\t\t\t\tthrow new Error('`getTimeToNextUpdate: true` feature is not supported by legacy \"styles\" that have a `custom` function')\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Get the list of available time interval units.\r\n\t\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t\t// create a new custom `style` instead.\r\n\t\t\t\tstyle.units,\r\n\t\t\t\tlabels,\r\n\t\t\t\tnowLabel\r\n\t\t\t)\r\n\r\n\t\t\t// Choose the appropriate time measurement unit\r\n\t\t\t// and get the corresponding rounded time amount.\r\n\t\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\t\tsecondsPassed,\r\n\t\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t\t)\r\n\r\n\t\t\tconst getText = () => {\r\n\t\t\t\treturn this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tlabelsType,\r\n\t\t\t\t\tnowLabel,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t}) || ''\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the time (in milliseconds) after which the formatted date label should be refreshed.\r\n\t\t\t//\r\n\t\t\t// It will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\tconst getTextRefreshDelay = () => {\r\n\t\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\t\tnextStep,\r\n\t\t\t\t\tprevStep,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t})\r\n\r\n\t\t\t\t// `timeToNextUpdate` could be `undefined` for a custom style\r\n\t\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t\t// See the README for more details.\r\n\t\t\t\tif (typeof timeToNextUpdate === 'number') {\r\n\t\t\t\t\t// `setTimeout()` function has a bug when it fires immediately\r\n\t\t\t\t\t// when the delay is longer than about `24.85` days.\r\n\t\t\t\t\t// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// To not burden the end user of this library with manually working around that bug,\r\n\t\t\t\t\t// this library automatically caps the returned delay to a maximum value that\r\n\t\t\t\t\t// still works with `setTimeout()` and doesn't break it.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// The end user of this library could still opt out of this auto-workaround feature\r\n\t\t\t\t\t// by passing a `getTimeToNextUpdateUncapped: true` option.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (options.getTimeToNextUpdateUncapped) {\r\n\t\t\t\t\t\treturn timeToNextUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn getSafeTimeoutDelay(timeToNextUpdate)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn { getText, getTextRefreshDelay }\r\n\t\t}\r\n\r\n\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({ now })\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\treturn [getText(), getTextRefreshDelay()]\r\n\t\t}\r\n\r\n\t\tif (options.refresh) {\r\n\t\t\t// `getTextRefreshDelay()` will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\t// This is a \"sensible default\" interval for refreshing time labels\r\n\t\t\t// that use such custom style.\r\n\t\t\t//\r\n\t\t\tconst defaultRefreshInterval = 60 * 1000\r\n\r\n\t\t\t// If `refresh` function was passed, schedule it to be called when the time comes,\r\n\t\t\t// after which schedule the next refresh.\r\n\t\t\tlet refreshTimer\r\n\t\t\tconst scheduleRefresh = (delay = defaultRefreshInterval) => {\r\n\t\t\t\trefreshTimer = setTimeoutSafe(() => {\r\n\t\t\t\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({\r\n\t\t\t\t\t\tnow: now + (Date.now() - nowRealWhenCalled)\r\n\t\t\t\t\t})\r\n\t\t\t\t\toptions.refresh(getText())\r\n\t\t\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\t\t\t\t}, delay)\r\n\t\t\t}\r\n\r\n\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\r\n\t\t\tconst stopRefreshing = () => {\r\n\t\t\t\tclearTimeout(refreshTimer)\r\n\t\t\t}\r\n\r\n\t\t\treturn [getText(), stopRefreshing]\r\n\t\t}\r\n\r\n\t\treturn getText()\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, amount) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(amount, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => {\r\n\tdefaultLocale = locale\r\n}\r\n\r\n/**\r\n * Adds locale data for a specific locale and marks the locale as default.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\t// Warn the user if they've previously already added a default locale (a different one).\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tif (TimeAgo.getDefaultLocale() !== localeData.locale) {\r\n\t\t\tconsole.warn(`[javascript-time-ago] You're adding \"${localeData.locale}\" as the default locale but you have already added \"${TimeAgo.getDefaultLocale()}\" as the default locale. \"${localeData.locale}\" is the default locale now.`)\r\n\t\t}\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\r\n\t// `addDefaultLocale()` is just a shortcut to `addLocale()` + `setDefaultLocale()`.\r\n\tTimeAgo.addLocale(localeData)\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified = false\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\n// `setTimeout()` function has a bug when it fires immediately\r\n// when the delay is longer than about `24.85` days.\r\n// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n//\r\n// Since `renderLabel()` function uses `setTimeout()` for recursion,\r\n// that would mean infinite recursion.\r\n//\r\n// `setTimeoutSafe()` function works around that bug\r\n// by capping the delay at the maximum allowed value.\r\n//\r\nfunction setTimeoutSafe(func, delay) {\r\n return setTimeout(func, getSafeTimeoutDelay(delay))\r\n}\r\nfunction getSafeTimeoutDelay(delay) {\r\n return Math.min(delay, SET_TIMEOUT_MAX_SAFE_DELAY)\r\n}\r\nconst SET_TIMEOUT_MAX_SAFE_DELAY = 2147483647"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK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CAACX,MAAM,EAAEkG,SAAS,EAAEC,UAAU,EAAE1F,MAAM,EAAE;EAC3D,IAAMC,QAAQ,GAAGV,MAAM,CAACG,GAAG,IAAK+F,SAAS,IAAIA,SAAS,CAAC/F,GAAI;EAC3D;EACA,IAAIO,QAAQ,EAAE;IACb;IACA,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MACjC,OAAOA,QAAQ;IAChB;IACA;IACA;IACA;IACA;IACA;IACA,IAAID,MAAM,EAAE;MACX,OAAOC,QAAQ,CAACD,MAAM;IACvB,CAAC,MAAM;MACN,OAAOC,QAAQ,CAAC0F,IAAI;IACrB;EACD;EACA;EACA,IAAID,UAAU,IAAIA,UAAU,CAACE,MAAM,IAAIF,UAAU,CAACE,MAAM,CAACC,OAAO,EAAE;IACjE,OAAOH,UAAU,CAACE,MAAM,CAACC,OAAO;EACjC;AACD;AAEA,SAAS9G,OAAOA,CAAC+G,QAAQ,EAAE;EAC1B,OAAO,OAAOA,QAAQ,KAAK,QAAQ,IAAI,IAAAC,yBAAa,EAACD,QAAQ,CAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS7D,cAAcA,CAAC+D,IAAI,EAAEhE,KAAK,EAAE;EACnC,OAAOiE,UAAU,CAACD,IAAI,EAAEtE,mBAAmB,CAACM,KAAK,CAAC,CAAC;AACrD;AACA,SAASN,mBAAmBA,CAACM,KAAK,EAAE;EAClC,OAAOa,IAAI,CAACqD,GAAG,CAAClE,KAAK,EAAEmE,0BAA0B,CAAC;AACpD;AACA,IAAMA,0BAA0B,GAAG,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"TimeAgo.js","names":["_relativeTimeFormat","_interopRequireDefault","require","_cache","_locale","_isStyleObject","_getStep3","_getStepDenominator","_getTimeToNextUpdate","_LocaleDataStore","_roundMinute","_getStyleByName","_round","e","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_createForOfIteratorHelperLoose","r","t","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","done","value","TypeError","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_nonIterableRest","a","_arrayLikeToArray","toString","slice","name","from","test","n","l","i","u","f","Object","push","_classCallCheck","_defineProperties","enumerable","configurable","writable","defineProperty","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","TimeAgo","exports","locales","arguments","undefined","_ref","polyfill","locale","chooseLocale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","format","input","style","options","_this","isStyle","defaultStyle","getStyleByName","timestamp","getTimestamp","_this$getLabels","getLabels","flavour","labels","labelsType","round","now","nowRealWhenCalled","Date","getTextAndTextRefreshDelayGetterFunctions","_ref2","secondsPassed","future","nowLabel","getNowLabel","custom","text","date","time","elapsed","getText","getTextRefreshDelay","Error","units","getTimeIntervalMeasurementUnits","_getStep","getStep","gradation","steps","getNextStep","_getStep2","prevStep","step","nextStep","formatDateForStep","timeToNextUpdate","getTimeToNextUpdate","getTimeToNextUpdateUncapped","getSafeTimeoutDelay","_getTextAndTextRefres","refresh","defaultRefreshInterval","refreshTimer","scheduleRefresh","delay","setTimeoutSafe","_getTextAndTextRefres2","stopRefreshing","clearTimeout","_ref3","_this2","formatAs","unit","amount","formatValue","JSON","stringify","Math","abs","getStepDenominator","granularity","getRoundFunction","valueForFormatting","sign","getFormatter","_ref4","getFormattingRule","replace","formatNumber","formattingRules","_ref5","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","get","put","map","localeData","_iterator","_step","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","warn","addLocale","addLocaleData","addLabels","isMockedDate","getTime","object","allowedUnits","keys","filter","indexOf","nowLabels","longLabels","past","second","current","variable","isStyleObject","func","setTimeout","min","SET_TIMEOUT_MAX_SAFE_DELAY"],"sources":["../source/TimeAgo.js"],"sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache.js'\r\nimport chooseLocale from './locale.js'\r\nimport isStyleObject from './isStyleObject.js'\r\n\r\nimport getStep from './steps/getStep.js'\r\nimport getStepDenominator from './steps/getStepDenominator.js'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate.js'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore.js'\r\n\r\nimport defaultStyle from './style/roundMinute.js'\r\nimport getStyleByName from './style/getStyleByName.js'\r\n\r\nimport { getRoundFunction } from './round.js'\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {(number|Date)} input — A `Date` or a javascript timestamp.\r\n\t *\r\n\t * @param {(string|object)} style — Date/time formatting style. Either one of the built-in style names or a \"custom\" style definition object having `steps: object[]` and `labels: string[]`.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdateUncapped] — Pass `true` to not apply the workaround for `setTimeout()` bug. https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t *\r\n\t * @param {function} [options.refresh] — When `refresh` function is passed, it will be automatically called with a new text when it's time to refresh the label.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\t// `round` setting could be passed as a parameter to `.format()` function\r\n\t\t// or be configured globally for a style.\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// A developer can pass a custom `now`, e.g. for testing purposes.\r\n\t\tlet now\r\n\t\tconst nowRealWhenCalled = Date.now()\r\n\t\t// (deprecated)\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// One could pass `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\t// The default `now` is `Date.now()`.\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = nowRealWhenCalled\r\n\t\t}\r\n\r\n\t\tconst getTextAndTextRefreshDelayGetterFunctions = ({ now }) => {\r\n\t\t\t// how much time has passed (in seconds)\r\n\t\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\t\tconst nowLabel = getNowLabel(\r\n\t\t\t\tlabels,\r\n\t\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\t\tfuture\r\n\t\t\t)\r\n\r\n\t\t\t// (deprecated)\r\n\t\t\t//\r\n\t\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t\t//\r\n\t\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t\t// This feature is currently not used anywhere and is here\r\n\t\t\t// just for providing the ultimate customization point\r\n\t\t\t// in case anyone would ever need that. Prefer using\r\n\t\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t\t//\r\n\t\t\tif (style.custom) {\r\n\t\t\t\tconst text = style.custom({\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\t\ttime: timestamp,\r\n\t\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\t\tlocale: this.locale\r\n\t\t\t\t})\r\n\t\t\t\tif (text !== undefined) {\r\n\t\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tgetText: () => text,\r\n\t\t\t\t\t\tgetTextRefreshDelay: () => {\r\n\t\t\t\t\t\t\tthrow new Error('`getTimeToNextUpdate: true` feature is not supported by legacy \"styles\" that have a `custom` function')\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Get the list of available time interval units.\r\n\t\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t\t// create a new custom `style` instead.\r\n\t\t\t\tstyle.units,\r\n\t\t\t\tlabels,\r\n\t\t\t\tnowLabel\r\n\t\t\t)\r\n\r\n\t\t\t// Choose the appropriate time measurement unit\r\n\t\t\t// and get the corresponding rounded time amount.\r\n\t\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\t\tsecondsPassed,\r\n\t\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t\t)\r\n\r\n\t\t\tconst getText = () => {\r\n\t\t\t\treturn this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tlabelsType,\r\n\t\t\t\t\tnowLabel,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t}) || ''\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the time (in milliseconds) after which the formatted date label should be refreshed.\r\n\t\t\t//\r\n\t\t\t// It will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\tconst getTextRefreshDelay = () => {\r\n\t\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\t\tnextStep,\r\n\t\t\t\t\tprevStep,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t})\r\n\r\n\t\t\t\t// `timeToNextUpdate` could be `undefined` for a custom style\r\n\t\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t\t// See the README for more details.\r\n\t\t\t\tif (typeof timeToNextUpdate === 'number') {\r\n\t\t\t\t\t// `setTimeout()` function has a bug when it fires immediately\r\n\t\t\t\t\t// when the delay is longer than about `24.85` days.\r\n\t\t\t\t\t// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// In order to not burden the end users of this library with manually working around that bug,\r\n\t\t\t\t\t// this library automatically caps the returned delay to a maximum value of about `24.85` days\r\n\t\t\t\t\t// which still works correctly with `setTimeout()` function and doesn't break it.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// The end user of this library could still disable this automatic workaround\r\n\t\t\t\t\t// by passing a `getTimeToNextUpdateUncapped: true` parameter.\r\n\t\t\t\t\t// In that case, it will return the original non-modified uncapped delay\r\n\t\t\t\t\t// which can be longer than `24.85` days and should be manually capped\r\n\t\t\t\t\t// by the developer if it's going to be used in a `setTimeout()` call.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (options.getTimeToNextUpdateUncapped) {\r\n\t\t\t\t\t\treturn timeToNextUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn getSafeTimeoutDelay(timeToNextUpdate)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn { getText, getTextRefreshDelay }\r\n\t\t}\r\n\r\n\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({ now })\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\treturn [getText(), getTextRefreshDelay()]\r\n\t\t}\r\n\r\n\t\tif (options.refresh) {\r\n\t\t\t// `getTextRefreshDelay()` will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\t// This is a \"sensible default\" interval for refreshing time labels\r\n\t\t\t// that use such custom style.\r\n\t\t\t//\r\n\t\t\tconst defaultRefreshInterval = 60 * 1000\r\n\r\n\t\t\t// If `refresh` function was passed, schedule it to be called when the time comes,\r\n\t\t\t// after which schedule the next refresh.\r\n\t\t\tlet refreshTimer\r\n\t\t\tconst scheduleRefresh = (delay = defaultRefreshInterval) => {\r\n\t\t\t\trefreshTimer = setTimeoutSafe(() => {\r\n\t\t\t\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({\r\n\t\t\t\t\t\tnow: now + (Date.now() - nowRealWhenCalled)\r\n\t\t\t\t\t})\r\n\t\t\t\t\toptions.refresh(getText())\r\n\t\t\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\t\t\t\t}, delay)\r\n\t\t\t}\r\n\r\n\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\r\n\t\t\tconst stopRefreshing = () => {\r\n\t\t\t\tclearTimeout(refreshTimer)\r\n\t\t\t}\r\n\r\n\t\t\treturn [getText(), stopRefreshing]\r\n\t\t}\r\n\r\n\t\treturn getText()\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, amount) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(amount, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => {\r\n\tdefaultLocale = locale\r\n}\r\n\r\n/**\r\n * Adds locale data for a specific locale and marks the locale as default.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\t// Warn the user if they've previously already added a default locale (a different one).\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tif (TimeAgo.getDefaultLocale() !== localeData.locale) {\r\n\t\t\tconsole.warn(`[javascript-time-ago] You're adding \"${localeData.locale}\" as the default locale but you have already added \"${TimeAgo.getDefaultLocale()}\" as the default locale. \"${localeData.locale}\" is the default locale now.`)\r\n\t\t}\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\r\n\t// `addDefaultLocale()` is just a shortcut to `addLocale()` + `setDefaultLocale()`.\r\n\tTimeAgo.addLocale(localeData)\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified = false\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\n// `setTimeout()` function has a bug when it fires immediately\r\n// when the delay is longer than about `24.85` days.\r\n// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n//\r\n// Since `renderLabel()` function uses `setTimeout()` for recursion,\r\n// that would mean infinite recursion.\r\n//\r\n// `setTimeoutSafe()` function works around that bug\r\n// by capping the delay at the maximum allowed value.\r\n//\r\nfunction setTimeoutSafe(func, delay) {\r\n return setTimeout(func, getSafeTimeoutDelay(delay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mB,CAACM,KAAK,CAAC,CAAC;AACrD;AACA,SAASN,mBAAmBA,CAACM,KAAK,EAAE;EAClC,OAAOa,IAAI,CAACqD,GAAG,CAAClE,KAAK,EAAEmE,0BAA0B,CAAC;AACpD;AACA,IAAMA,0BAA0B,GAAG,UAAU","ignoreList":[]}
package/index.d.ts CHANGED
@@ -123,6 +123,21 @@ interface FormatOptions {
123
123
 
124
124
  interface FormatOptionsWithGetTimeToNextUpdate extends FormatOptions {
125
125
  getTimeToNextUpdate: boolean;
126
+
127
+ // `setTimeout()` function has a bug when it fires immediately
128
+ // when the delay is longer than about `24.85` days.
129
+ // https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values
130
+ //
131
+ // In order to not burden the end users of this library with manually working around that bug,
132
+ // this library automatically caps the returned delay to a maximum value of about `24.85` days
133
+ // which still works correctly with `setTimeout()` function and doesn't break it.
134
+ //
135
+ // The end user of this library could still disable this automatic workaround
136
+ // by passing a `getTimeToNextUpdateUncapped: true` parameter.
137
+ // In that case, it will return the original non-modified uncapped delay
138
+ // which can be longer than `24.85` days and should be manually capped
139
+ // by the developer if it's going to be used in a `setTimeout()` call.
140
+ //
126
141
  getTimeToNextUpdateUncapped?: boolean;
127
142
  }
128
143
 
@@ -131,17 +146,41 @@ interface FormatOptionsWithRefresh extends FormatOptions {
131
146
  }
132
147
 
133
148
  export default class TimeAgo {
149
+ // Creates a `TimeAgo` instance.
134
150
  constructor(locale: Locale | Locale[], options?: { polyfill?: boolean });
135
- // When `getTimeToNextUpdate: true` option is passed to `.format()`,
136
- // it returns an array containing the formatted time and the "time to next update" interval.
137
- // https://gitlab.com/catamphetamine/javascript-time-ago#update-interval
138
- // Perhaps it's not the best solution, and it would be better to introduce a new function called
139
- // `.formatAndGetTimeToNextUpdate()`. But at this stage that would require a "major" version number update,
140
- // and I wouldn't prefer doing that for such an insignificant change.
151
+
152
+ // Calling `.format()` function normally.
141
153
  format(date: DateInput, style?: FormatStyleName | Style, options?: FormatOptions): string;
154
+
155
+ // Calling `.format()` with `getTimeToNextUpdate: true` parameter.
156
+ //
157
+ // When `.format()` is called with `getTimeToNextUpdate: true` parameter,
158
+ // it returns an array containing the formatted time and the "time to next update" delay.
159
+ //
160
+ // Perhaps returning an array is not the best solution, and it would've been better
161
+ // to introduce a new function called `.formatAndGetTimeToNextUpdate()` or something like that.
162
+ // But at this stage it already returns an array and changing that would require
163
+ // a "major" version number update, and I would prefer not doing that for such an insignificant change.
164
+ //
142
165
  format(date: DateInput, options: FormatOptionsWithGetTimeToNextUpdate): [string, number?];
166
+ format(date: DateInput, style: FormatStyleName | Style, options: FormatOptionsWithGetTimeToNextUpdate): [string, number?];
167
+
168
+ // Calling `.format()` with a `refresh()` parameter.
169
+ //
170
+ // When `.format()` is called with a `refresh()` parameter,
171
+ // it returns an array containing the formatted time and the "stop refreshing" function.
172
+ //
173
+ // I.e. it mimicks the return value of already-existing `getTimeToNextUpdate: true` parameter.
174
+ //
143
175
  format(date: DateInput, options: FormatOptionsWithRefresh): [string, () => void];
144
- getLabels(labelsType: LabelStyleName | LabelStyleName[]): Labels;
176
+ format(date: DateInput, style: FormatStyleName | Style, options: FormatOptionsWithRefresh): [string, () => void];
177
+
178
+ // `getLabels()` function seems to be unused and is not documented.
179
+ // Perhaps it even wasn't ever declared as part of the public API
180
+ // and got in this TypeScript definition by accident.
181
+ //
182
+ // getLabels(labelsType: LabelStyleName | LabelStyleName[]): Labels;
183
+
145
184
  static addLocale(localeData: LocaleData): void;
146
185
  static addDefaultLocale(localeData: LocaleData): void;
147
186
  static getDefaultLocale(): Locale;
@@ -236,12 +236,15 @@ var TimeAgo = /*#__PURE__*/function () {
236
236
  // when the delay is longer than about `24.85` days.
237
237
  // https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values
238
238
  //
239
- // To not burden the end user of this library with manually working around that bug,
240
- // this library automatically caps the returned delay to a maximum value that
241
- // still works with `setTimeout()` and doesn't break it.
239
+ // In order to not burden the end users of this library with manually working around that bug,
240
+ // this library automatically caps the returned delay to a maximum value of about `24.85` days
241
+ // which still works correctly with `setTimeout()` function and doesn't break it.
242
242
  //
243
- // The end user of this library could still opt out of this auto-workaround feature
244
- // by passing a `getTimeToNextUpdateUncapped: true` option.
243
+ // The end user of this library could still disable this automatic workaround
244
+ // by passing a `getTimeToNextUpdateUncapped: true` parameter.
245
+ // In that case, it will return the original non-modified uncapped delay
246
+ // which can be longer than `24.85` days and should be manually capped
247
+ // by the developer if it's going to be used in a `setTimeout()` call.
245
248
  //
246
249
  if (options.getTimeToNextUpdateUncapped) {
247
250
  return timeToNextUpdate;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeAgo.js","names":["RelativeTimeFormatPolyfill","Cache","chooseLocale","isStyleObject","getStep","getStepDenominator","getTimeToNextUpdate","addLocaleData","getLocaleData","defaultStyle","getStyleByName","getRoundFunction","TimeAgo","locales","arguments","length","undefined","_ref","polyfill","_classCallCheck","locale","concat","getDefaultLocale","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","relativeTimeFormatCache","pluralRulesCache","_createClass","key","value","format","input","style","options","_this","isStyle","timestamp","getTimestamp","_this$getLabels","getLabels","flavour","labels","labelsType","round","now","nowRealWhenCalled","Date","getTextAndTextRefreshDelayGetterFunctions","_ref2","secondsPassed","future","nowLabel","getNowLabel","custom","text","date","time","elapsed","getText","getTextRefreshDelay","Error","units","getTimeIntervalMeasurementUnits","_getStep","gradation","steps","getNextStep","_getStep2","_slicedToArray","prevStep","step","nextStep","formatDateForStep","timeToNextUpdate","getTimeToNextUpdateUncapped","getSafeTimeoutDelay","_getTextAndTextRefres","refresh","defaultRefreshInterval","refreshTimer","scheduleRefresh","delay","setTimeoutSafe","_getTextAndTextRefres2","stopRefreshing","clearTimeout","_ref3","_this2","formatAs","unit","amount","formatValue","JSON","stringify","Math","abs","granularity","valueForFormatting","sign","getFormatter","_ref4","getFormattingRule","replace","formatNumber","formattingRules","_ref5","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_iterator","_createForOfIteratorHelperLoose","_step","done","_labelsType","default","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","warn","addLocale","addLabels","name","constructor","isMockedDate","getTime","_typeof","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","variable","func","setTimeout","min","SET_TIMEOUT_MAX_SAFE_DELAY"],"sources":["../source/TimeAgo.js"],"sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache.js'\r\nimport chooseLocale from './locale.js'\r\nimport isStyleObject from './isStyleObject.js'\r\n\r\nimport getStep from './steps/getStep.js'\r\nimport getStepDenominator from './steps/getStepDenominator.js'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate.js'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore.js'\r\n\r\nimport defaultStyle from './style/roundMinute.js'\r\nimport getStyleByName from './style/getStyleByName.js'\r\n\r\nimport { getRoundFunction } from './round.js'\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {(number|Date)} input — A `Date` or a javascript timestamp.\r\n\t *\r\n\t * @param {(string|object)} style — Date/time formatting style. Either one of the built-in style names or a \"custom\" style definition object having `steps: object[]` and `labels: string[]`.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdateUncapped] — Pass `true` to not apply the workaround for `setTimeout()` bug. https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t *\r\n\t * @param {function} [options.refresh] — When `refresh` function is passed, it will be automatically called with a new text when it's time to refresh the label.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\t// `round` setting could be passed as a parameter to `.format()` function\r\n\t\t// or be configured globally for a style.\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// A developer can pass a custom `now`, e.g. for testing purposes.\r\n\t\tlet now\r\n\t\tconst nowRealWhenCalled = Date.now()\r\n\t\t// (deprecated)\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// One could pass `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\t// The default `now` is `Date.now()`.\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = nowRealWhenCalled\r\n\t\t}\r\n\r\n\t\tconst getTextAndTextRefreshDelayGetterFunctions = ({ now }) => {\r\n\t\t\t// how much time has passed (in seconds)\r\n\t\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\t\tconst nowLabel = getNowLabel(\r\n\t\t\t\tlabels,\r\n\t\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\t\tfuture\r\n\t\t\t)\r\n\r\n\t\t\t// (deprecated)\r\n\t\t\t//\r\n\t\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t\t//\r\n\t\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t\t// This feature is currently not used anywhere and is here\r\n\t\t\t// just for providing the ultimate customization point\r\n\t\t\t// in case anyone would ever need that. Prefer using\r\n\t\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t\t//\r\n\t\t\tif (style.custom) {\r\n\t\t\t\tconst text = style.custom({\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\t\ttime: timestamp,\r\n\t\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\t\tlocale: this.locale\r\n\t\t\t\t})\r\n\t\t\t\tif (text !== undefined) {\r\n\t\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tgetText: () => text,\r\n\t\t\t\t\t\tgetTextRefreshDelay: () => {\r\n\t\t\t\t\t\t\tthrow new Error('`getTimeToNextUpdate: true` feature is not supported by legacy \"styles\" that have a `custom` function')\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Get the list of available time interval units.\r\n\t\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t\t// create a new custom `style` instead.\r\n\t\t\t\tstyle.units,\r\n\t\t\t\tlabels,\r\n\t\t\t\tnowLabel\r\n\t\t\t)\r\n\r\n\t\t\t// Choose the appropriate time measurement unit\r\n\t\t\t// and get the corresponding rounded time amount.\r\n\t\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\t\tsecondsPassed,\r\n\t\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t\t)\r\n\r\n\t\t\tconst getText = () => {\r\n\t\t\t\treturn this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tlabelsType,\r\n\t\t\t\t\tnowLabel,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t}) || ''\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the time (in milliseconds) after which the formatted date label should be refreshed.\r\n\t\t\t//\r\n\t\t\t// It will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\tconst getTextRefreshDelay = () => {\r\n\t\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\t\tnextStep,\r\n\t\t\t\t\tprevStep,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t})\r\n\r\n\t\t\t\t// `timeToNextUpdate` could be `undefined` for a custom style\r\n\t\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t\t// See the README for more details.\r\n\t\t\t\tif (typeof timeToNextUpdate === 'number') {\r\n\t\t\t\t\t// `setTimeout()` function has a bug when it fires immediately\r\n\t\t\t\t\t// when the delay is longer than about `24.85` days.\r\n\t\t\t\t\t// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// To not burden the end user of this library with manually working around that bug,\r\n\t\t\t\t\t// this library automatically caps the returned delay to a maximum value that\r\n\t\t\t\t\t// still works with `setTimeout()` and doesn't break it.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// The end user of this library could still opt out of this auto-workaround feature\r\n\t\t\t\t\t// by passing a `getTimeToNextUpdateUncapped: true` option.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (options.getTimeToNextUpdateUncapped) {\r\n\t\t\t\t\t\treturn timeToNextUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn getSafeTimeoutDelay(timeToNextUpdate)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn { getText, getTextRefreshDelay }\r\n\t\t}\r\n\r\n\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({ now })\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\treturn [getText(), getTextRefreshDelay()]\r\n\t\t}\r\n\r\n\t\tif (options.refresh) {\r\n\t\t\t// `getTextRefreshDelay()` will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\t// This is a \"sensible default\" interval for refreshing time labels\r\n\t\t\t// that use such custom style.\r\n\t\t\t//\r\n\t\t\tconst defaultRefreshInterval = 60 * 1000\r\n\r\n\t\t\t// If `refresh` function was passed, schedule it to be called when the time comes,\r\n\t\t\t// after which schedule the next refresh.\r\n\t\t\tlet refreshTimer\r\n\t\t\tconst scheduleRefresh = (delay = defaultRefreshInterval) => {\r\n\t\t\t\trefreshTimer = setTimeoutSafe(() => {\r\n\t\t\t\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({\r\n\t\t\t\t\t\tnow: now + (Date.now() - nowRealWhenCalled)\r\n\t\t\t\t\t})\r\n\t\t\t\t\toptions.refresh(getText())\r\n\t\t\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\t\t\t\t}, delay)\r\n\t\t\t}\r\n\r\n\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\r\n\t\t\tconst stopRefreshing = () => {\r\n\t\t\t\tclearTimeout(refreshTimer)\r\n\t\t\t}\r\n\r\n\t\t\treturn [getText(), stopRefreshing]\r\n\t\t}\r\n\r\n\t\treturn getText()\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, amount) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(amount, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => {\r\n\tdefaultLocale = locale\r\n}\r\n\r\n/**\r\n * Adds locale data for a specific locale and marks the locale as default.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\t// Warn the user if they've previously already added a default locale (a different one).\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tif (TimeAgo.getDefaultLocale() !== localeData.locale) {\r\n\t\t\tconsole.warn(`[javascript-time-ago] You're adding \"${localeData.locale}\" as the default locale but you have already added \"${TimeAgo.getDefaultLocale()}\" as the default locale. \"${localeData.locale}\" is the default locale now.`)\r\n\t\t}\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\r\n\t// `addDefaultLocale()` is just a shortcut to `addLocale()` + `setDefaultLocale()`.\r\n\tTimeAgo.addLocale(localeData)\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified = false\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\n// `setTimeout()` function has a bug when it fires immediately\r\n// when the delay is longer than about `24.85` days.\r\n// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n//\r\n// Since `renderLabel()` function uses `setTimeout()` for recursion,\r\n// that would mean infinite recursion.\r\n//\r\n// `setTimeoutSafe()` function works around that bug\r\n// by capping the delay at the maximum allowed value.\r\n//\r\nfunction setTimeoutSafe(func, delay) {\r\n return setTimeout(func, getSafeTimeoutDelay(delay))\r\n}\r\nfunction getSafeTimeoutDelay(delay) {\r\n return Math.min(delay, SET_TIMEOUT_MAX_SAFE_DELAY)\r\n}\r\nconst SET_TIMEOUT_MAX_SAFE_DELAY = 2147483647"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,0BAA0B,MAAM,sBAAsB;AAE7D,OAAOC,KAAK,MAAM,YAAY;AAC9B,OAAOC,YAAY,MAAM,aAAa;AACtC,OAAOC,aAAa,MAAM,oBAAoB;AAE9C,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAOC,kBAAkB,MAAM,+BAA+B;AAC9D,OAAOC,mBAAmB,MAAM,gCAAgC;AAEhE,SACCC,aAAa,EACbC,aAAa,QACP,sBAAsB;AAE7B,OAAOC,YAAY,MAAM,wBAAwB;AACjD,OAAOC,cAAc,MAAM,2BAA2B;AAEtD,SAASC,gBAAgB,QAAQ,YAAY;AAAA,IAExBC,OAAO;EAC3B;AACD;AACA;AACA;EACC,SAAAA,QAAA,EAA6C;IAAA,IAAjCC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IAAAG,IAAA,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAiB,CAAC,CAAC;MAAfI,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,eAAA,OAAAP,OAAA;IACnC;IACA,IAAI,OAAOC,OAAO,KAAK,QAAQ,EAAE;MAChCA,OAAO,GAAG,CAACA,OAAO,CAAC;IACpB;;IAEA;IACA;IACA;IACA,IAAI,CAACO,MAAM,GAAGlB,YAAY,CACzBW,OAAO,CAACQ,MAAM,CAACT,OAAO,CAACU,gBAAgB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CAACkF,OAAO,CAACtD,IAAI,CAAC,IAAI,CAAC;IAAA,EAAC;EAChF;EAEA,OAAO5B,KAAK;AACb;AAEA,SAAST,WAAWA,CAACX,MAAM,EAAEuG,SAAS,EAAEC,UAAU,EAAE/F,MAAM,EAAE;EAC3D,IAAMC,QAAQ,GAAGV,MAAM,CAACG,GAAG,IAAKoG,SAAS,IAAIA,SAAS,CAACpG,GAAI;EAC3D;EACA,IAAIO,QAAQ,EAAE;IACb;IACA,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MACjC,OAAOA,QAAQ;IAChB;IACA;IACA;IACA;IACA;IACA;IACA,IAAID,MAAM,EAAE;MACX,OAAOC,QAAQ,CAACD,MAAM;IACvB,CAAC,MAAM;MACN,OAAOC,QAAQ,CAAC+F,IAAI;IACrB;EACD;EACA;EACA,IAAID,UAAU,IAAIA,UAAU,CAACE,MAAM,IAAIF,UAAU,CAACE,MAAM,CAACC,OAAO,EAAE;IACjE,OAAOH,UAAU,CAACE,MAAM,CAACC,OAAO;EACjC;AACD;AAEA,SAASjH,OAAOA,CAACkH,QAAQ,EAAE;EAC1B,OAAO,OAAOA,QAAQ,KAAK,QAAQ,IAAIvJ,aAAa,CAACuJ,QAAQ,CAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnE,cAAcA,CAACoE,IAAI,EAAErE,KAAK,EAAE;EACnC,OAAOsE,UAAU,CAACD,IAAI,EAAE3E,mBAAmB,CAACM,KAAK,CAAC,CAAC;AACrD;AACA,SAASN,mBAAmBA,CAACM,KAAK,EAAE;EAClC,OAAOa,IAAI,CAAC0D,GAAG,CAACvE,KAAK,EAAEwE,0BAA0B,CAAC;AACpD;AACA,IAAMA,0BAA0B,GAAG,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"TimeAgo.js","names":["RelativeTimeFormatPolyfill","Cache","chooseLocale","isStyleObject","getStep","getStepDenominator","getTimeToNextUpdate","addLocaleData","getLocaleData","defaultStyle","getStyleByName","getRoundFunction","TimeAgo","locales","arguments","length","undefined","_ref","polyfill","_classCallCheck","locale","concat","getDefaultLocale","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","relativeTimeFormatCache","pluralRulesCache","_createClass","key","value","format","input","style","options","_this","isStyle","timestamp","getTimestamp","_this$getLabels","getLabels","flavour","labels","labelsType","round","now","nowRealWhenCalled","Date","getTextAndTextRefreshDelayGetterFunctions","_ref2","secondsPassed","future","nowLabel","getNowLabel","custom","text","date","time","elapsed","getText","getTextRefreshDelay","Error","units","getTimeIntervalMeasurementUnits","_getStep","gradation","steps","getNextStep","_getStep2","_slicedToArray","prevStep","step","nextStep","formatDateForStep","timeToNextUpdate","getTimeToNextUpdateUncapped","getSafeTimeoutDelay","_getTextAndTextRefres","refresh","defaultRefreshInterval","refreshTimer","scheduleRefresh","delay","setTimeoutSafe","_getTextAndTextRefres2","stopRefreshing","clearTimeout","_ref3","_this2","formatAs","unit","amount","formatValue","JSON","stringify","Math","abs","granularity","valueForFormatting","sign","getFormatter","_ref4","getFormattingRule","replace","formatNumber","formattingRules","_ref5","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_iterator","_createForOfIteratorHelperLoose","_step","done","_labelsType","default","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","warn","addLocale","addLabels","name","constructor","isMockedDate","getTime","_typeof","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","variable","func","setTimeout","min","SET_TIMEOUT_MAX_SAFE_DELAY"],"sources":["../source/TimeAgo.js"],"sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache.js'\r\nimport chooseLocale from './locale.js'\r\nimport isStyleObject from './isStyleObject.js'\r\n\r\nimport getStep from './steps/getStep.js'\r\nimport getStepDenominator from './steps/getStepDenominator.js'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate.js'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore.js'\r\n\r\nimport defaultStyle from './style/roundMinute.js'\r\nimport getStyleByName from './style/getStyleByName.js'\r\n\r\nimport { getRoundFunction } from './round.js'\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {(number|Date)} input — A `Date` or a javascript timestamp.\r\n\t *\r\n\t * @param {(string|object)} style — Date/time formatting style. Either one of the built-in style names or a \"custom\" style definition object having `steps: object[]` and `labels: string[]`.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdateUncapped] — Pass `true` to not apply the workaround for `setTimeout()` bug. https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t *\r\n\t * @param {function} [options.refresh] — When `refresh` function is passed, it will be automatically called with a new text when it's time to refresh the label.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\t// `round` setting could be passed as a parameter to `.format()` function\r\n\t\t// or be configured globally for a style.\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// A developer can pass a custom `now`, e.g. for testing purposes.\r\n\t\tlet now\r\n\t\tconst nowRealWhenCalled = Date.now()\r\n\t\t// (deprecated)\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// One could pass `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\t// The default `now` is `Date.now()`.\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = nowRealWhenCalled\r\n\t\t}\r\n\r\n\t\tconst getTextAndTextRefreshDelayGetterFunctions = ({ now }) => {\r\n\t\t\t// how much time has passed (in seconds)\r\n\t\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\t\tconst nowLabel = getNowLabel(\r\n\t\t\t\tlabels,\r\n\t\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\t\tfuture\r\n\t\t\t)\r\n\r\n\t\t\t// (deprecated)\r\n\t\t\t//\r\n\t\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t\t//\r\n\t\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t\t// This feature is currently not used anywhere and is here\r\n\t\t\t// just for providing the ultimate customization point\r\n\t\t\t// in case anyone would ever need that. Prefer using\r\n\t\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t\t//\r\n\t\t\tif (style.custom) {\r\n\t\t\t\tconst text = style.custom({\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\t\ttime: timestamp,\r\n\t\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\t\tlocale: this.locale\r\n\t\t\t\t})\r\n\t\t\t\tif (text !== undefined) {\r\n\t\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tgetText: () => text,\r\n\t\t\t\t\t\tgetTextRefreshDelay: () => {\r\n\t\t\t\t\t\t\tthrow new Error('`getTimeToNextUpdate: true` feature is not supported by legacy \"styles\" that have a `custom` function')\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Get the list of available time interval units.\r\n\t\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t\t// create a new custom `style` instead.\r\n\t\t\t\tstyle.units,\r\n\t\t\t\tlabels,\r\n\t\t\t\tnowLabel\r\n\t\t\t)\r\n\r\n\t\t\t// Choose the appropriate time measurement unit\r\n\t\t\t// and get the corresponding rounded time amount.\r\n\t\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\t\tsecondsPassed,\r\n\t\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t\t)\r\n\r\n\t\t\tconst getText = () => {\r\n\t\t\t\treturn this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tlabelsType,\r\n\t\t\t\t\tnowLabel,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t}) || ''\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the time (in milliseconds) after which the formatted date label should be refreshed.\r\n\t\t\t//\r\n\t\t\t// It will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\tconst getTextRefreshDelay = () => {\r\n\t\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\t\tnextStep,\r\n\t\t\t\t\tprevStep,\r\n\t\t\t\t\tnow,\r\n\t\t\t\t\tfuture,\r\n\t\t\t\t\tround\r\n\t\t\t\t})\r\n\r\n\t\t\t\t// `timeToNextUpdate` could be `undefined` for a custom style\r\n\t\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t\t// See the README for more details.\r\n\t\t\t\tif (typeof timeToNextUpdate === 'number') {\r\n\t\t\t\t\t// `setTimeout()` function has a bug when it fires immediately\r\n\t\t\t\t\t// when the delay is longer than about `24.85` days.\r\n\t\t\t\t\t// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// In order to not burden the end users of this library with manually working around that bug,\r\n\t\t\t\t\t// this library automatically caps the returned delay to a maximum value of about `24.85` days\r\n\t\t\t\t\t// which still works correctly with `setTimeout()` function and doesn't break it.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// The end user of this library could still disable this automatic workaround\r\n\t\t\t\t\t// by passing a `getTimeToNextUpdateUncapped: true` parameter.\r\n\t\t\t\t\t// In that case, it will return the original non-modified uncapped delay\r\n\t\t\t\t\t// which can be longer than `24.85` days and should be manually capped\r\n\t\t\t\t\t// by the developer if it's going to be used in a `setTimeout()` call.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (options.getTimeToNextUpdateUncapped) {\r\n\t\t\t\t\t\treturn timeToNextUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn getSafeTimeoutDelay(timeToNextUpdate)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn { getText, getTextRefreshDelay }\r\n\t\t}\r\n\r\n\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({ now })\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\treturn [getText(), getTextRefreshDelay()]\r\n\t\t}\r\n\r\n\t\tif (options.refresh) {\r\n\t\t\t// `getTextRefreshDelay()` will return `undefined` for a custom style\r\n\t\t\t// that doesn't meet the minimum requirements for this feature.\r\n\t\t\t// See the README for more details.\r\n\t\t\t//\r\n\t\t\t// This is a \"sensible default\" interval for refreshing time labels\r\n\t\t\t// that use such custom style.\r\n\t\t\t//\r\n\t\t\tconst defaultRefreshInterval = 60 * 1000\r\n\r\n\t\t\t// If `refresh` function was passed, schedule it to be called when the time comes,\r\n\t\t\t// after which schedule the next refresh.\r\n\t\t\tlet refreshTimer\r\n\t\t\tconst scheduleRefresh = (delay = defaultRefreshInterval) => {\r\n\t\t\t\trefreshTimer = setTimeoutSafe(() => {\r\n\t\t\t\t\tconst { getText, getTextRefreshDelay } = getTextAndTextRefreshDelayGetterFunctions({\r\n\t\t\t\t\t\tnow: now + (Date.now() - nowRealWhenCalled)\r\n\t\t\t\t\t})\r\n\t\t\t\t\toptions.refresh(getText())\r\n\t\t\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\t\t\t\t}, delay)\r\n\t\t\t}\r\n\r\n\t\t\tscheduleRefresh(getTextRefreshDelay())\r\n\r\n\t\t\tconst stopRefreshing = () => {\r\n\t\t\t\tclearTimeout(refreshTimer)\r\n\t\t\t}\r\n\r\n\t\t\treturn [getText(), stopRefreshing]\r\n\t\t}\r\n\r\n\t\treturn getText()\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, amount) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(amount, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => {\r\n\tdefaultLocale = locale\r\n}\r\n\r\n/**\r\n * Adds locale data for a specific locale and marks the locale as default.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\t// Warn the user if they've previously already added a default locale (a different one).\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tif (TimeAgo.getDefaultLocale() !== localeData.locale) {\r\n\t\t\tconsole.warn(`[javascript-time-ago] You're adding \"${localeData.locale}\" as the default locale but you have already added \"${TimeAgo.getDefaultLocale()}\" as the default locale. \"${localeData.locale}\" is the default locale now.`)\r\n\t\t}\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\r\n\t// `addDefaultLocale()` is just a shortcut to `addLocale()` + `setDefaultLocale()`.\r\n\tTimeAgo.addLocale(localeData)\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified = false\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\n// `setTimeout()` function has a bug when it fires immediately\r\n// when the delay is longer than about `24.85` days.\r\n// https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values\r\n//\r\n// Since `renderLabel()` function uses `setTimeout()` for recursion,\r\n// that would mean infinite recursion.\r\n//\r\n// `setTimeoutSafe()` function works around that bug\r\n// by capping the delay at the maximum allowed value.\r\n//\r\nfunction setTimeoutSafe(func, delay) {\r\n return setTimeout(func, getSafeTimeoutDelay(delay))\r\n}\r\nfunction getSafeTimeoutDelay(delay) {\r\n return Math.min(delay, SET_TIMEOUT_MAX_SAFE_DELAY)\r\n}\r\nconst SET_TIMEOUT_MAX_SAFE_DELAY = 2147483647"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,0BAA0B,MAAM,sBAAsB;AAE7D,OAAOC,KAAK,MAAM,YAAY;AA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IACA;IACA;IACA;IACA;IACA;IACA,IAAID,MAAM,EAAE;MACX,OAAOC,QAAQ,CAACD,MAAM;IACvB,CAAC,MAAM;MACN,OAAOC,QAAQ,CAAC+F,IAAI;IACrB;EACD;EACA;EACA,IAAID,UAAU,IAAIA,UAAU,CAACE,MAAM,IAAIF,UAAU,CAACE,MAAM,CAACC,OAAO,EAAE;IACjE,OAAOH,UAAU,CAACE,MAAM,CAACC,OAAO;EACjC;AACD;AAEA,SAASjH,OAAOA,CAACkH,QAAQ,EAAE;EAC1B,OAAO,OAAOA,QAAQ,KAAK,QAAQ,IAAIvJ,aAAa,CAACuJ,QAAQ,CAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnE,cAAcA,CAACoE,IAAI,EAAErE,KAAK,EAAE;EACnC,OAAOsE,UAAU,CAACD,IAAI,EAAE3E,mBAAmB,CAACM,KAAK,CAAC,CAAC;AACrD;AACA,SAASN,mBAAmBA,CAACM,KAAK,EAAE;EAClC,OAAOa,IAAI,CAAC0D,GAAG,CAACvE,KAAK,EAAEwE,0BAA0B,CAAC;AACpD;AACA,IAAMA,0BAA0B,GAAG,UAAU","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-time-ago",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Localized relative date/time formatting",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -2648,15 +2648,15 @@
2648
2648
  "build-commonjs": "npm-run-all build-commonjs-modules-with-tests build-commonjs-package.json",
2649
2649
  "build-commonjs-modules": "cross-env babel ./source --out-dir ./commonjs --source-maps --ignore *.test.js",
2650
2650
  "build-commonjs-modules-with-tests": "cross-env babel ./source --out-dir ./commonjs --source-maps",
2651
- "build-commonjs-package.json": "node bin/create-commonjs-package-json.js",
2651
+ "build-commonjs-package.json": "node scripts/create-commonjs-package-json.js",
2652
2652
  "build-es6-modules": "cross-env BABEL_ENV=es6 babel ./source --out-dir ./modules --source-maps --ignore *.test.js",
2653
2653
  "build": "npm-run-all clean-for-build build-commonjs build-es6-modules browser-build",
2654
2654
  "prepublishOnly": "npm-run-all generate-locales build test",
2655
2655
  "update-relative-time-format": "npm install relative-time-format@latest --save",
2656
2656
  "delete-locales": "rimraf ./locale/**/*",
2657
2657
  "create-locales-directory": "mkdirp locale",
2658
- "generate-locale-messages": "node bin/generate-locale-messages",
2659
- "generate-load-all-locales": "node bin/generate-load-all-locales",
2658
+ "generate-locale-messages": "node scripts/generate-locale-messages",
2659
+ "generate-load-all-locales": "node scripts/generate-load-all-locales",
2660
2660
  "generate-locales": "npm-run-all update-relative-time-format delete-locales create-locales-directory generate-locale-messages generate-load-all-locales"
2661
2661
  },
2662
2662
  "repository": {
File without changes