javascript-time-ago 2.3.7 → 2.3.8

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.
@@ -532,7 +532,7 @@ TimeAgo.setDefaultLocale = function (locale) {
532
532
 
533
533
  TimeAgo.addDefaultLocale = function (localeData) {
534
534
  if (defaultLocaleHasBeenSpecified) {
535
- throw new Error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.');
535
+ return console.error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.');
536
536
  }
537
537
 
538
538
  defaultLocaleHasBeenSpecified = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/TimeAgo.js"],"names":["UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","input","style","options","isStyle","undefined","defaultStyle","timestamp","getTimestamp","getLabels","flavour","labels","labelsType","now","Date","secondsPassed","future","nowLabel","getNowLabel","long","custom","date","time","elapsed","units","getTimeIntervalMeasurementUnits","round","gradation","steps","getNextStep","prevStep","step","nextStep","formattedDate","formatDateForStep","getTimeToNextUpdate","timeToNextUpdate","format","formatAs","unit","value","formatValue","Error","JSON","stringify","amount","Math","abs","granularity","valueForFormatting","sign","getFormatter","getFormattingRule","replace","formatNumber","formattingRules","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","addLocale","addLabels","name","constructor","isMockedDate","getTime","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","OBJECT_CONSTRUCTOR","isObject","variable","isStyleObject","Array","isArray"],"mappings":";;;;;;;;AAAA;;AA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AD,CAApD;AACA;;AAEM,SAASC,aAAT,CAAuBf,MAAvB,EAA+B;AACrC,SAAOa,QAAQ,CAACb,MAAD,CAAR,KACNgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACnD,KAArB,KACA;AACAmE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACpD,SAArB,CAFA,IAGA;AACAoE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrE,OAArB,CAJA,IAKA,OAAOqE,MAAM,CAACrE,OAAd,KAA0B,QAL1B,IAMAqF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACpE,MAArB,CANA,IAOA,OAAOoE,MAAM,CAACpE,MAAd,KAAyB,QAPzB,IAQA;AACAoF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACvD,KAArB,CATA,IAUA;AACA,SAAOuD,MAAM,CAAC3D,MAAd,KAAyB,UAZnB,CAAP;AAcA","sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache'\r\nimport chooseLocale from './locale'\r\nimport getStep from './steps/getStep'\r\nimport getStepDenominator from './steps/getStepDenominator'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore'\r\n\r\nimport defaultStyle from './style/roundMinute'\r\nimport getStyleByName from './style/getStyleByName'\r\n\r\nimport { getRoundFunction } from './round'\r\n\r\n// Valid time units.\r\nconst UNITS = [\r\n\t'now',\r\n\t// The rest are the same as in `Intl.RelativeTimeFormat`.\r\n\t'second',\r\n\t'minute',\r\n\t'hour',\r\n\t'day',\r\n\t'week',\r\n\t'month',\r\n\t'quarter',\r\n\t'year'\r\n]\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} [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 * @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\tlet now\r\n\t\t// Can pass a custom `now`, e.g. for testing purposes.\r\n\t\t//\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\t// That way is deprecated.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// The new way is passing `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\tif (now === undefined) {\r\n\t\t\tnow = Date.now()\r\n\t\t}\r\n\r\n\t\t// how much time has passed (in seconds)\r\n\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\tconst nowLabel = getNowLabel(\r\n\t\t\tlabels,\r\n\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\tfuture\r\n\t\t)\r\n\r\n\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t//\r\n\t\t// Looks like `custom` function is deprecated and will be removed\r\n\t\t// in the next major version.\r\n\t\t//\r\n\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t// This feature is currently not used anywhere and is here\r\n\t\t// just for providing the ultimate customization point\r\n\t\t// in case anyone would ever need that. Prefer using\r\n\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t//\r\n\t\tif (style.custom) {\r\n\t\t\tconst custom = style.custom({\r\n\t\t\t\tnow,\r\n\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\ttime: timestamp,\r\n\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\tlocale: this.locale\r\n\t\t\t})\r\n\t\t\tif (custom !== undefined) {\r\n\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\treturn custom\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Get the list of available time interval units.\r\n\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t// create a new custom `style` instead.\r\n\t\t\tstyle.units,\r\n\t\t\tlabels,\r\n\t\t\tnowLabel\r\n\t\t)\r\n\r\n\t\t// // If no available time unit is suitable, just output an empty string.\r\n\t\t// if (units.length === 0) {\r\n\t\t// \tconsole.error(`None of the \"${units.join(', ')}\" time units have been found in \"${labelsType}\" labels for \"${this.locale}\" locale.`)\r\n\t\t// \treturn ''\r\n\t\t// }\r\n\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// Choose the appropriate time measurement unit\r\n\t\t// and get the corresponding rounded time amount.\r\n\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\tsecondsPassed,\r\n\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t)\r\n\r\n\t\tconst formattedDate = this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\tlabels,\r\n\t\t\tlabelsType,\r\n\t\t\tnowLabel,\r\n\t\t\tnow,\r\n\t\t\tfuture,\r\n\t\t\tround\r\n\t\t}) || ''\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\tnextStep,\r\n\t\t\t\tprevStep,\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture,\r\n\t\t\t\tround\r\n\t\t\t})\r\n\t\t\treturn [formattedDate, timeToNextUpdate]\r\n\t\t}\r\n\r\n\t\treturn formattedDate\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, value) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(value, 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) => defaultLocale = locale\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tthrow new Error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.')\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n\tTimeAgo.addLocale(localeData)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified\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\nconst OBJECT_CONSTRUCTOR = {}.constructor\r\nfunction isObject(object) {\r\n\treturn typeof object !== undefined && object !== null && object.constructor === OBJECT_CONSTRUCTOR\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\nexport function isStyleObject(object) {\r\n\treturn isObject(object) && (\r\n\t\tArray.isArray(object.steps) ||\r\n\t\t// `gradation` property is deprecated: it has been renamed to `steps`.\r\n\t\tArray.isArray(object.gradation) ||\r\n\t\t// `flavour` property is deprecated: it has been renamed to `labels`.\r\n\t\tArray.isArray(object.flavour) ||\r\n\t\ttypeof object.flavour === 'string' ||\r\n\t\tArray.isArray(object.labels) ||\r\n\t\ttypeof object.labels === 'string' ||\r\n\t\t// `units` property is deprecated.\r\n\t\tArray.isArray(object.units) ||\r\n\t\t// `custom` property is deprecated.\r\n\t\ttypeof object.custom === 'function'\r\n\t)\r\n}"],"file":"TimeAgo.js"}
1
+ {"version":3,"sources":["../source/TimeAgo.js"],"names":["UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","input","style","options","isStyle","undefined","defaultStyle","timestamp","getTimestamp","getLabels","flavour","labels","labelsType","now","Date","secondsPassed","future","nowLabel","getNowLabel","long","custom","date","time","elapsed","units","getTimeIntervalMeasurementUnits","round","gradation","steps","getNextStep","prevStep","step","nextStep","formattedDate","formatDateForStep","getTimeToNextUpdate","timeToNextUpdate","format","formatAs","unit","value","formatValue","Error","JSON","stringify","amount","Math","abs","granularity","valueForFormatting","sign","getFormatter","getFormattingRule","replace","formatNumber","formattingRules","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","error","addLocale","addLabels","name","constructor","isMockedDate","getTime","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","OBJECT_CONSTRUCTOR","isObject","variable","isStyleObject","Array","isArray"],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,QAApB,IAAgCC,aAAa,CAACD,QAAD,CAApD;AACA;;AAEM,SAASC,aAAT,CAAuBf,MAAvB,EAA+B;AACrC,SAAOa,QAAQ,CAACb,MAAD,CAAR,KACNgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrD,KAArB,KACA;AACAqE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtD,SAArB,CAFA,IAGA;AACAsE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACvE,OAArB,CAJA,IAKA,OAAOuE,MAAM,CAACvE,OAAd,KAA0B,QAL1B,IAMAuF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtE,MAArB,CANA,IAOA,OAAOsE,MAAM,CAACtE,MAAd,KAAyB,QAPzB,IAQA;AACAsF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACzD,KAArB,CATA,IAUA;AACA,SAAOyD,MAAM,CAAC7D,MAAd,KAAyB,UAZnB,CAAP;AAcA","sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache'\r\nimport chooseLocale from './locale'\r\nimport getStep from './steps/getStep'\r\nimport getStepDenominator from './steps/getStepDenominator'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore'\r\n\r\nimport defaultStyle from './style/roundMinute'\r\nimport getStyleByName from './style/getStyleByName'\r\n\r\nimport { getRoundFunction } from './round'\r\n\r\n// Valid time units.\r\nconst UNITS = [\r\n\t'now',\r\n\t// The rest are the same as in `Intl.RelativeTimeFormat`.\r\n\t'second',\r\n\t'minute',\r\n\t'hour',\r\n\t'day',\r\n\t'week',\r\n\t'month',\r\n\t'quarter',\r\n\t'year'\r\n]\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} [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 * @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\tlet now\r\n\t\t// Can pass a custom `now`, e.g. for testing purposes.\r\n\t\t//\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\t// That way is deprecated.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// The new way is passing `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\tif (now === undefined) {\r\n\t\t\tnow = Date.now()\r\n\t\t}\r\n\r\n\t\t// how much time has passed (in seconds)\r\n\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\tconst nowLabel = getNowLabel(\r\n\t\t\tlabels,\r\n\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\tfuture\r\n\t\t)\r\n\r\n\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t//\r\n\t\t// Looks like `custom` function is deprecated and will be removed\r\n\t\t// in the next major version.\r\n\t\t//\r\n\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t// This feature is currently not used anywhere and is here\r\n\t\t// just for providing the ultimate customization point\r\n\t\t// in case anyone would ever need that. Prefer using\r\n\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t//\r\n\t\tif (style.custom) {\r\n\t\t\tconst custom = style.custom({\r\n\t\t\t\tnow,\r\n\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\ttime: timestamp,\r\n\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\tlocale: this.locale\r\n\t\t\t})\r\n\t\t\tif (custom !== undefined) {\r\n\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\treturn custom\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Get the list of available time interval units.\r\n\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t// create a new custom `style` instead.\r\n\t\t\tstyle.units,\r\n\t\t\tlabels,\r\n\t\t\tnowLabel\r\n\t\t)\r\n\r\n\t\t// // If no available time unit is suitable, just output an empty string.\r\n\t\t// if (units.length === 0) {\r\n\t\t// \tconsole.error(`None of the \"${units.join(', ')}\" time units have been found in \"${labelsType}\" labels for \"${this.locale}\" locale.`)\r\n\t\t// \treturn ''\r\n\t\t// }\r\n\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// Choose the appropriate time measurement unit\r\n\t\t// and get the corresponding rounded time amount.\r\n\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\tsecondsPassed,\r\n\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t)\r\n\r\n\t\tconst formattedDate = this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\tlabels,\r\n\t\t\tlabelsType,\r\n\t\t\tnowLabel,\r\n\t\t\tnow,\r\n\t\t\tfuture,\r\n\t\t\tround\r\n\t\t}) || ''\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\tnextStep,\r\n\t\t\t\tprevStep,\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture,\r\n\t\t\t\tround\r\n\t\t\t})\r\n\t\t\treturn [formattedDate, timeToNextUpdate]\r\n\t\t}\r\n\r\n\t\treturn formattedDate\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, value) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(value, 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) => defaultLocale = locale\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\treturn console.error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.')\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n\tTimeAgo.addLocale(localeData)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified\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\nconst OBJECT_CONSTRUCTOR = {}.constructor\r\nfunction isObject(object) {\r\n\treturn typeof object !== undefined && object !== null && object.constructor === OBJECT_CONSTRUCTOR\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\nexport function isStyleObject(object) {\r\n\treturn isObject(object) && (\r\n\t\tArray.isArray(object.steps) ||\r\n\t\t// `gradation` property is deprecated: it has been renamed to `steps`.\r\n\t\tArray.isArray(object.gradation) ||\r\n\t\t// `flavour` property is deprecated: it has been renamed to `labels`.\r\n\t\tArray.isArray(object.flavour) ||\r\n\t\ttypeof object.flavour === 'string' ||\r\n\t\tArray.isArray(object.labels) ||\r\n\t\ttypeof object.labels === 'string' ||\r\n\t\t// `units` property is deprecated.\r\n\t\tArray.isArray(object.units) ||\r\n\t\t// `custom` property is deprecated.\r\n\t\ttypeof object.custom === 'function'\r\n\t)\r\n}"],"file":"TimeAgo.js"}
@@ -641,13 +641,13 @@ describe("javascript-time-ago", function () {
641
641
  locale: 'el'
642
642
  });
643
643
 
644
- _TimeAgo.default.getDefaultLocale().should.equal('el');
644
+ _TimeAgo.default.getDefaultLocale().should.equal('el'); // expect(() => {
645
+
646
+
647
+ _TimeAgo.default.addDefaultLocale({
648
+ locale: 'el'
649
+ }); // }).to.throw('`TimeAgo.addDefaultLocale()` can only be called once')
645
650
 
646
- expect(function () {
647
- _TimeAgo.default.addDefaultLocale({
648
- locale: 'el'
649
- });
650
- }).to.throw('`TimeAgo.addDefaultLocale()` can only be called once');
651
651
 
652
652
  _TimeAgo.default.setDefaultLocale('en');
653
653
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/TimeAgo.test.js"],"names":["TimeAgo","setDefaultLocale","describe","it","timeAgo","format","Date","now","should","equal","future","labels","steps","formatAs","flavour","gradation","englishNow","english","addLocale","undefined","NumberFormat","Intl","englishLongTimeMinute","minute","past","mockedDate","getTime","thrower","throw","units","custom","time","date","locale","style2","style","unit","factor","secondLabels","second","getTimeToNextUpdate","round","deep","minTime","polyfill","global","expect","to","getDefaultLocale","addDefaultLocale"],"mappings":";;AAAA;;AACA;;AA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ent":["import TimeAgo, { isStyleObject } from '../source/TimeAgo'\r\nimport { getLocaleData } from '../source/LocaleDataStore'\r\n\r\n// Load locale specific relative date/time messages\r\nimport english from '../locale/en'\r\n\r\n// Just so this function code is covered.\r\nTimeAgo.setDefaultLocale('en')\r\n\r\ndescribe(`javascript-time-ago`, () => {\r\n\tit('should default to \"round-minute\" style', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now()).should.equal('just now')\r\n\t\ttimeAgo.format(Date.now() + 20 * 1000).should.equal('in a moment')\r\n\t\ttimeAgo.format(Date.now() + 1 * 60 * 1000).should.equal('in 1 minute')\r\n\t\ttimeAgo.format(Date.now() + 4 * 60 * 1000).should.equal('in 4 minutes')\r\n\t})\r\n\r\n\tit('should tell `options` argument from `style` argument', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), 'mini-now').should.equal('now')\r\n\t\ttimeAgo.format(0, { future: true, now: 0 }).should.equal('in a moment')\r\n\t\ttimeAgo.format(0, { labels: 'mini', steps: [{ formatAs: 'now' }, { formatAs: 'second' }] }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { labels: ['mini'], steps: [{ formatAs: 'now' }, { formatAs: 'second' }] }, { future: true, now: 0 }).should.equal('now')\r\n\t\t// `flavour` is a legacy name of `labels` property.\r\n\t\ttimeAgo.format(0, { flavour: 'mini' }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { flavour: ['mini'] }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { steps: [{ formatAs: 'minute' }] }, { future: true, now: 0 }).should.equal('in 0 minutes')\r\n\t\t// `gradation` is a legacy name of `steps` property.\r\n\t\ttimeAgo.format(0, { gradation: [{ formatAs: 'minute' }] }, { future: true, now: 0 }).should.equal('in 0 minutes')\r\n\t})\r\n\r\n\tit('should try various label types until an appropriate one is found', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { labels: ['exotic', 'short'] }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should support the legacy name \"flavour\" of \"labels\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { labels: ['exotic', 'short'] }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should fallback to \"second.current\" for \"now\" when \"now\" is not defined', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishNow = english.now\r\n\t\tdelete english.now\r\n\t\tTimeAgo.addLocale(english)\r\n\t\tenglish.now = undefined\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('now')\r\n\t\tenglish.now = englishNow\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should not use Intl.NumberFormat if it is not available', () => {\r\n\t\tconst NumberFormat = Intl.NumberFormat\r\n\t\tdelete Intl.NumberFormat\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 60 * 1000, { labels: 'long-time' }).should.equal('1 minute')\r\n\t\tIntl.NumberFormat = NumberFormat\r\n\t})\r\n\r\n\tit('should work when \"past\"/\"future\" messages are same for all quantifiers', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 365 * 24 * 60 * 60 * 1000, { labels: 'short' }).should.equal('in 1 yr.')\r\n\t})\r\n\r\n\tit('should work when \"now\" is a string (does not differentiate between \"past\" and \"future\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishNow = english.now\r\n\t\tenglish.now = { now: 'now' }\r\n\t\tTimeAgo.addLocale(english)\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('now')\r\n\t\tenglish.now = englishNow\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should work when a unit has formatting rules for \"past\" and \"future\" which are strings (style: not \"long\", not \"short\", not \"narrow\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishLongTimeMinute = english['long-time'].minute\r\n\t\tenglish['long-time'].minute = {\r\n\t\t\tpast: '{0} minute(s) ago',\r\n\t\t\tfuture: 'in {0} minute(s)'\r\n\t\t}\r\n\t\tTimeAgo.addLocale(english)\r\n\t\t// Past.\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, { labels: 'long-time' }).should.equal('1 minute(s) ago')\r\n\t\t// Future (covers an \"else\" branch).\r\n\t\ttimeAgo.format(Date.now() + 60 * 1000, { labels: 'long-time' }).should.equal('in 1 minute(s)')\r\n\t\t// Undo.\r\n\t\tenglish['long-time'].minute = englishLongTimeMinute\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, { labels: 'long-time' }).should.equal('1 minute')\r\n\t})\r\n\r\n\tit(`should format \"now\" for \"past\" time`, () =>\r\n\t{\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 10, { labels: ['long'] }).should.equal('in a moment')\r\n\t})\r\n\r\n\tit('should accept a string style name argument', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// \"mini\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'mini').should.equal('0s')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'mini').should.equal('1s')\r\n\t\t// \"mini-now\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'mini-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'mini-now').should.equal('1s')\r\n\t\t// \"mini-minute-now\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'mini-minute-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'mini-minute-now').should.equal('1m')\r\n\t\t// \"mini-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'mini-minute').should.equal('0m')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'mini-minute').should.equal('1m')\r\n\t\t// \"twitter\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'twitter').should.equal('0s')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'twitter').should.equal('1s')\r\n\t\t// \"twitter-now\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'twitter-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'twitter-now').should.equal('1s')\r\n\t\t// \"twitter-minute-now\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-minute-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-minute-now').should.equal('1m')\r\n\t\t// \"twitter-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-minute').should.equal('0m')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-minute').should.equal('1m')\r\n\t\t// \"twitter-first-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-first-minute').should.equal('')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-first-minute').should.equal('1m')\r\n\t\t// \"approximate\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'approximate').should.equal('just now')\r\n\t\t// \"convenient\" style was renamed to \"approximate\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'convenient').should.equal('just now')\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'round').should.equal('45 seconds ago')\r\n\t\t// \"default\" style was renamed to \"round\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'default').should.equal('45 seconds ago')\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'round-minute').should.equal('just now')\r\n\t\t// \"time\" style was renamed to \"approximate-time\".\r\n\t\ttimeAgo.format(Date.now() - 2 * 60 * 1000, 'time').should.equal('2 minutes')\r\n\t\ttimeAgo.format(Date.now() - 2 * 60 * 1000, 'approximate-time').should.equal('2 minutes')\r\n\t\ttimeAgo.format(Date.now(), 'exotic').should.equal('just now')\r\n\t})\r\n\r\n\tit('should accept empty constructor parameters', () => {\r\n\t\tconst timeAgo = new TimeAgo()\r\n\t\ttimeAgo.format(new Date()).should.equal('just now')\r\n\t})\r\n\r\n\tit('should accept \"mocked\" Dates when testing', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst mockedDate = { getTime: () => Date.now() }\r\n\t\ttimeAgo.format(mockedDate).should.equal('just now')\r\n\t})\r\n\r\n\tit('should not accept anything but Dates and timestamps', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst thrower = () => timeAgo.format('Jan 14, 2017')\r\n\t\tthrower.should.throw('Unsupported relative time formatter input: string, Jan 14, 2017')\r\n\t})\r\n\r\n\tit('should return an empty string if the specified units are not available in locale data', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { units: ['femtosecond'] }).should.equal('')\r\n\t})\r\n\r\n\tit('should format for a style with \"custom\" function', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// `custom` returns a string\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tcustom({ now, time, date, locale }) {\r\n\t\t\t\treturn locale\r\n\t\t\t}\r\n\t\t})\r\n\t\t.should.equal('en')\r\n\r\n\t\t// `custom` returns `undefined`\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tcustom({ now, time, date, locale }) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t})\r\n\t\t.should.equal('just now')\r\n\t})\r\n\r\n\tit('should format future dates', () => {\r\n\t\tnew TimeAgo('en').format(Date.now() + 60 * 60 * 1000).should.equal('in 1 hour')\r\n\t\tnew TimeAgo('ru').format(Date.now() + 60 * 1000).should.equal('через 1 минуту')\r\n\t})\r\n\r\n\tit('should accept \"future\" option', () => {\r\n\t\t// \"now\" unit.\r\n\t\tnew TimeAgo('en').format(Date.now()).should.equal('just now')\r\n\t\tnew TimeAgo('en').format(Date.now(), 'approximate', { future: true }).should.equal('in a moment')\r\n\r\n\t\t// Non-\"now\" unit, \"long\" style.\r\n\t\t// const style = {\r\n\t\t// \tgradation: [{\r\n\t\t// \t\tfactor: 1,\r\n\t\t// \t\tunit: 'second'\r\n\t\t// \t}],\r\n\t\t// \tlabels: 'long'\r\n\t\t// }\r\n\t\t// new TimeAgo('en').format(Date.now(), style).should.equal('0 seconds ago')\r\n\t\t// new TimeAgo('en').format(Date.now(), style, { future: true }).should.equal('in 0 seconds')\r\n\r\n\t\t// Non-\"now\" unit, \"mini\" style.\r\n\t\tconst style2 = {\r\n\t\t\tstyle: [{\r\n\t\t\t\tunit: 'year'\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini'\r\n\t\t}\r\n\t\tnew TimeAgo('ru').format(Date.now() - 5 * 365 * 24 * 60 * 60 * 1000, style2).should.equal('5 л')\r\n\t\tnew TimeAgo('ru').format(Date.now() - 5 * 365 * 24 * 60 * 60 * 1000, style2, { future: true }).should.equal('5 л')\r\n\t})\r\n\r\n\tit('should support the legacy properties: \"gradation\", \"flavour\", \"factor\", \"unit\", \"\\'tiny\\'\" labels style', () => {\r\n\t\t// Non-\"now\" unit, \"tiny\" style.\r\n\t\tconst style = {\r\n\t\t\tgradation: [{\r\n\t\t\t\tfactor: 5,\r\n\t\t\t\tunit: 'year'\r\n\t\t\t}],\r\n\t\t\tflavour: 'tiny'\r\n\t\t}\r\n\t\tnew TimeAgo('ru').format(Date.now() - 10 * 1000, style).should.equal('2 г')\r\n\t\tnew TimeAgo('ru').format(Date.now() - 10 * 1000, style, { future: true }).should.equal('2 г')\r\n\t})\r\n\r\n\tit('should have generated missing quantifier functions for locales that do not have it in CLDR data', () => {\r\n\t\tnew TimeAgo('ccp').format(Date.now() + 60 * 1000).should.equal('1 𑄟𑄨𑄚𑄨𑄘𑄬')\r\n\t})\r\n\r\n\tit('should throw for non-existing locales', () => {\r\n\t\t(() => TimeAgo.addLocale()).should.throw('No locale data passed')\r\n\t})\r\n\r\n\tit('should choose \"future\" variant of a label for `0` if \"future: true\" option is passed', () => {\r\n\t\tTimeAgo.addLocale(english)\r\n\t\tconst secondLabels = english['mini'].second\r\n\t\tenglish['mini'].second = {\r\n\t\t\tpast: '{0} seconds ago',\r\n\t\t\tfuture: 'in {0} seconds'\r\n\t\t}\r\n\r\n\t\tnew TimeAgo('en').format(Date.now(), {\r\n\t\t\tsteps: [{\r\n\t\t\t\tunit: 'second'\r\n\t\t\t}],\r\n\t\t\t// Uses \"mini\" labels so that it doesn't use `Intl.RelativeTimeFormat`.\r\n\t\t\tlabels: 'mini'\r\n\t\t}).should.equal('0 seconds ago')\r\n\r\n\t\tnew TimeAgo('en').format(Date.now(), {\r\n\t\t\tsteps: [{\r\n\t\t\t\tunit: 'second'\r\n\t\t\t}],\r\n\t\t\t// Uses \"mini\" labels so that it doesn't use `Intl.RelativeTimeFormat`.\r\n\t\t\tlabels: 'mini'\r\n\t\t}, {\r\n\t\t\tfuture: true\r\n\t\t}).should.equal('in 0 seconds')\r\n\r\n\t\tenglish['mini'].second = secondLabels\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// in 1 second -> in 0 seconds.\r\n\t\ttimeAgo.format(1000, 'twitter', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// in 1 second -> in 0 seconds.\r\n\t\ttimeAgo.format(1000, 'twitter', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t501\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (\"mini-now\" style) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// In 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t// Right after zero point.\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (\"mini-now\" style) (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// In 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t500 + 1\r\n\t\t])\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 500 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59.5 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59.5 * 1000 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t// Right after zero point.\r\n\t\t\t500\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t500\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t500 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 500\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (first step has non-zero \"minTime\") (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// Future.\r\n\t\t// Inside the first step.\r\n\t\t// Updates soon.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: -0.5 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t0.5 * 1000 + 1\r\n\t\t])\r\n\r\n\t\t// Future.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates right after zero point.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60 * 1000\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'',\r\n\t\t\t59 * 1000 + 1\r\n\t\t])\r\n\r\n\t\t// Zero point.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates at the first step's `minTime`.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'',\r\n\t\t\t60 * 1000\r\n\t\t])\r\n\r\n\t\t// Past.\r\n\t\t// Inside the first step.\r\n\t\t// Updates at the next minute.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t60 * 1000\r\n\t\t])\r\n\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\t// Updates right after the zero point.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\t// Updates right after zero point.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\t// Updates at the next second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should pass `formatAs()` in `step.format()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformat(date, locale, { formatAs }) {\r\n\t\t\t\t\treturn formatAs('second', 1)\r\n\t\t\t\t}\r\n\t\t\t}]\r\n\t\t}).should.equal('in 1 second')\r\n\t})\r\n\r\n\tit('should support `polyfill: false` option', () => {\r\n\t\tconst timeAgo = new TimeAgo('en', { polyfill: false })\r\n\t\t// Still uses \"now\" labels, even when not polyfilled.\r\n\t\ttimeAgo.format(0, 'round', { now: 0 }).should.equal('just now')\r\n\t\ttimeAgo.format(1000, 'round', { now: 0 }).should.equal('in 1 second')\r\n\t})\r\n\r\n\tit('should not use Intl.NumberFormat if it is not available', () => {\r\n\t\tconst Intl = global.Intl\r\n\t\tglobal.Intl = undefined\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(1000, 'round', { now: 0 }).should.equal('in 1 second')\r\n\t\tglobal.Intl = Intl\r\n\t})\r\n\r\n\tit('should format `0` in past mode by default', () => {\r\n\t\tnew TimeAgo('en').format(0, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'second'\r\n\t\t\t}]\r\n\t\t}, { now: 0 }).should.equal('0 seconds ago')\r\n\t})\r\n\r\n\tit('should format `0` in future mode when `future: true` option was passed', () => {\r\n\t\tnew TimeAgo('en').format(0, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'second'\r\n\t\t\t}]\r\n\t\t}, { now: 0, future: true }).should.equal('in 0 seconds')\r\n\t})\r\n\r\n\tit('should throw if a step does not define `formatAs` or `format()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\texpect(() => timeAgo.format(Date.now() + 1000, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{}]\r\n\t\t})).to.throw('Each step must define either `formatAs` or `format()`.')\r\n\t})\r\n\r\n\tit('should add default locale', () => {\r\n\t\tTimeAgo.getDefaultLocale().should.equal('en')\r\n\t\tTimeAgo.addDefaultLocale({\r\n\t\t\tlocale: 'el'\r\n\t\t})\r\n\t\tTimeAgo.getDefaultLocale().should.equal('el')\r\n\t\texpect(() => {\r\n\t\t\tTimeAgo.addDefaultLocale({\r\n\t\t\t\tlocale: 'el'\r\n\t\t\t})\r\n\t\t}).to.throw('`TimeAgo.addDefaultLocale()` can only be called once')\r\n\t\tTimeAgo.setDefaultLocale('en')\r\n\t})\r\n\r\n\tit('should support \"floor\" rounding', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(0.9 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('0s')\r\n\t\ttimeAgo.format(1 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1s')\r\n\t\ttimeAgo.format(1.9 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1s')\r\n\t\ttimeAgo.format(2 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('2s')\r\n\t\ttimeAgo.format(1.9 * 60 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1m')\r\n\t\ttimeAgo.format(2 * 60 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('2m')\r\n\t})\r\n})\r\n\r\ndescribe('isStyleObject', () => {\r\n\tit('should detect a style object', () => {\r\n\t\tisStyleObject({\r\n\t\t\tgradation: []\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tsteps: []\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tflavour: 'long'\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tflavour: ['long']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tlabels: 'long'\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tlabels: ['long']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tunits: ['now']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor',\r\n\t\t\tnow: 0,\r\n\t\t\tgetTimeToNextUpdate: true\r\n\t\t}).should.equal(false)\r\n\t\tisStyleObject('round').should.equal(false)\r\n\t})\r\n})"],"file":"TimeAgo.test.js"}
1
+ {"version":3,"sources":["../source/TimeAgo.test.js"],"names":["TimeAgo","setDefaultLocale","describe","it","timeAgo","format","Date","now","should","equal","future","labels","steps","formatAs","flavour","gradation","englishNow","english","addLocale","undefined","NumberFormat","Intl","englishLongTimeMinute","minute","past","mockedDate","getTime","thrower","throw","units","custom","time","date","locale","style2","style","unit","factor","secondLabels","second","getTimeToNextUpdate","round","deep","minTime","polyfill","global","expect","to","getDefaultLocale","addDefaultLocale"],"mappings":";;AAAA;;AACA;;AAGA;;;;;;AADA;AAGA;AACAA,iBAAQC,gBAAR,CAAyB,IAAzB;;AAEAC,QAAQ,wBAAwB,YAAM;AACrCC,EAAAA,EAAE,CAAC,wCAAD,EAA2C,YAAM;AAClD,QAAMC,OAAO,GAAG,IAAIJ,gBAAJ,CAAY,IAAZ,CAAhB;AACAI,IAAAA,OAAO,CAACC,MAAR,CAAeC,IAAI,CAACC,GAAL,EAAf,EAA2BC,MAA3B,CAAkCC,KAAlC,CAAwC,UAAxC;AACAL,IAAAA,OAAO,CAACC,MAAR,CAAeC,IAAI,CAACC,GAAL,KAAa,KAAK,IAAjC,EA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,gCAAc;AACbK,MAAAA,OAAO,EAAE;AADI,KAAd,EAEGN,MAFH,CAEUC,KAFV,CAEgB,IAFhB;AAGA,gCAAc;AACbK,MAAAA,OAAO,EAAE,CAAC,MAAD;AADI,KAAd,EAEGN,MAFH,CAEUC,KAFV,CAEgB,IAFhB;AAGA,gCAAc;AACbE,MAAAA,MAAM,EAAE;AADK,KAAd,EAEGH,MAFH,CAEUC,KAFV,CAEgB,IAFhB;AAGA,gCAAc;AACbE,MAAAA,MAAM,EAAE,CAAC,MAAD;AADK,KAAd,EAEGH,MAFH,CAEUC,KAFV,CAEgB,IAFhB;AAGA,gCAAc;AACboB,MAAAA,KAAK,EAAE,CAAC,KAAD;AADM,KAAd,EAEGrB,MAFH,CAEUC,KAFV,CAEgB,IAFhB;AAGA,gCAAc;AACbC,MAAAA,MAAM,EAAE,IADK;AAEb+B,MAAAA,KAAK,EAAE,OAFM;AAGblC,MAAAA,GAAG,EAAE,CAHQ;AAIbiC,MAAAA,mBAAmB,EAAE;AAJR,KAAd,EAKGhC,MALH,CAKUC,KALV,CAKgB,KALhB;AAMA,gCAAc,OAAd,EAAuBD,MAAvB,CAA8BC,KAA9B,CAAoC,KAApC;AACA,GA7BC,CAAF;AA8BA,CA/BO,CAAR","sourcesContent":["import TimeAgo, { isStyleObject } from '../source/TimeAgo'\r\nimport { getLocaleData } from '../source/LocaleDataStore'\r\n\r\n// Load locale specific relative date/time messages\r\nimport english from '../locale/en'\r\n\r\n// Just so this function code is covered.\r\nTimeAgo.setDefaultLocale('en')\r\n\r\ndescribe(`javascript-time-ago`, () => {\r\n\tit('should default to \"round-minute\" style', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now()).should.equal('just now')\r\n\t\ttimeAgo.format(Date.now() + 20 * 1000).should.equal('in a moment')\r\n\t\ttimeAgo.format(Date.now() + 1 * 60 * 1000).should.equal('in 1 minute')\r\n\t\ttimeAgo.format(Date.now() + 4 * 60 * 1000).should.equal('in 4 minutes')\r\n\t})\r\n\r\n\tit('should tell `options` argument from `style` argument', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), 'mini-now').should.equal('now')\r\n\t\ttimeAgo.format(0, { future: true, now: 0 }).should.equal('in a moment')\r\n\t\ttimeAgo.format(0, { labels: 'mini', steps: [{ formatAs: 'now' }, { formatAs: 'second' }] }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { labels: ['mini'], steps: [{ formatAs: 'now' }, { formatAs: 'second' }] }, { future: true, now: 0 }).should.equal('now')\r\n\t\t// `flavour` is a legacy name of `labels` property.\r\n\t\ttimeAgo.format(0, { flavour: 'mini' }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { flavour: ['mini'] }, { future: true, now: 0 }).should.equal('now')\r\n\t\ttimeAgo.format(0, { steps: [{ formatAs: 'minute' }] }, { future: true, now: 0 }).should.equal('in 0 minutes')\r\n\t\t// `gradation` is a legacy name of `steps` property.\r\n\t\ttimeAgo.format(0, { gradation: [{ formatAs: 'minute' }] }, { future: true, now: 0 }).should.equal('in 0 minutes')\r\n\t})\r\n\r\n\tit('should try various label types until an appropriate one is found', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { labels: ['exotic', 'short'] }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should support the legacy name \"flavour\" of \"labels\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { labels: ['exotic', 'short'] }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should fallback to \"second.current\" for \"now\" when \"now\" is not defined', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishNow = english.now\r\n\t\tdelete english.now\r\n\t\tTimeAgo.addLocale(english)\r\n\t\tenglish.now = undefined\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('now')\r\n\t\tenglish.now = englishNow\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should not use Intl.NumberFormat if it is not available', () => {\r\n\t\tconst NumberFormat = Intl.NumberFormat\r\n\t\tdelete Intl.NumberFormat\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 60 * 1000, { labels: 'long-time' }).should.equal('1 minute')\r\n\t\tIntl.NumberFormat = NumberFormat\r\n\t})\r\n\r\n\tit('should work when \"past\"/\"future\" messages are same for all quantifiers', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 365 * 24 * 60 * 60 * 1000, { labels: 'short' }).should.equal('in 1 yr.')\r\n\t})\r\n\r\n\tit('should work when \"now\" is a string (does not differentiate between \"past\" and \"future\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishNow = english.now\r\n\t\tenglish.now = { now: 'now' }\r\n\t\tTimeAgo.addLocale(english)\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('now')\r\n\t\tenglish.now = englishNow\r\n\t\ttimeAgo.format(Date.now(), { labels: 'long' }).should.equal('just now')\r\n\t})\r\n\r\n\tit('should work when a unit has formatting rules for \"past\" and \"future\" which are strings (style: not \"long\", not \"short\", not \"narrow\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst englishLongTimeMinute = english['long-time'].minute\r\n\t\tenglish['long-time'].minute = {\r\n\t\t\tpast: '{0} minute(s) ago',\r\n\t\t\tfuture: 'in {0} minute(s)'\r\n\t\t}\r\n\t\tTimeAgo.addLocale(english)\r\n\t\t// Past.\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, { labels: 'long-time' }).should.equal('1 minute(s) ago')\r\n\t\t// Future (covers an \"else\" branch).\r\n\t\ttimeAgo.format(Date.now() + 60 * 1000, { labels: 'long-time' }).should.equal('in 1 minute(s)')\r\n\t\t// Undo.\r\n\t\tenglish['long-time'].minute = englishLongTimeMinute\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, { labels: 'long-time' }).should.equal('1 minute')\r\n\t})\r\n\r\n\tit(`should format \"now\" for \"past\" time`, () =>\r\n\t{\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now() + 10, { labels: ['long'] }).should.equal('in a moment')\r\n\t})\r\n\r\n\tit('should accept a string style name argument', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// \"mini\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'mini').should.equal('0s')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'mini').should.equal('1s')\r\n\t\t// \"mini-now\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'mini-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'mini-now').should.equal('1s')\r\n\t\t// \"mini-minute-now\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'mini-minute-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'mini-minute-now').should.equal('1m')\r\n\t\t// \"mini-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'mini-minute').should.equal('0m')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'mini-minute').should.equal('1m')\r\n\t\t// \"twitter\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'twitter').should.equal('0s')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'twitter').should.equal('1s')\r\n\t\t// \"twitter-now\".\r\n\t\ttimeAgo.format(Date.now() - 0 * 1000, 'twitter-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 1 * 1000, 'twitter-now').should.equal('1s')\r\n\t\t// \"twitter-minute-now\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-minute-now').should.equal('now')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-minute-now').should.equal('1m')\r\n\t\t// \"twitter-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-minute').should.equal('0m')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-minute').should.equal('1m')\r\n\t\t// \"twitter-first-minute\".\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'twitter-first-minute').should.equal('')\r\n\t\ttimeAgo.format(Date.now() - 60 * 1000, 'twitter-first-minute').should.equal('1m')\r\n\t\t// \"approximate\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'approximate').should.equal('just now')\r\n\t\t// \"convenient\" style was renamed to \"approximate\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'convenient').should.equal('just now')\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'round').should.equal('45 seconds ago')\r\n\t\t// \"default\" style was renamed to \"round\".\r\n\t\ttimeAgo.format(Date.now() - 45 * 1000, 'default').should.equal('45 seconds ago')\r\n\t\ttimeAgo.format(Date.now() - 29 * 1000, 'round-minute').should.equal('just now')\r\n\t\t// \"time\" style was renamed to \"approximate-time\".\r\n\t\ttimeAgo.format(Date.now() - 2 * 60 * 1000, 'time').should.equal('2 minutes')\r\n\t\ttimeAgo.format(Date.now() - 2 * 60 * 1000, 'approximate-time').should.equal('2 minutes')\r\n\t\ttimeAgo.format(Date.now(), 'exotic').should.equal('just now')\r\n\t})\r\n\r\n\tit('should accept empty constructor parameters', () => {\r\n\t\tconst timeAgo = new TimeAgo()\r\n\t\ttimeAgo.format(new Date()).should.equal('just now')\r\n\t})\r\n\r\n\tit('should accept \"mocked\" Dates when testing', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst mockedDate = { getTime: () => Date.now() }\r\n\t\ttimeAgo.format(mockedDate).should.equal('just now')\r\n\t})\r\n\r\n\tit('should not accept anything but Dates and timestamps', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst thrower = () => timeAgo.format('Jan 14, 2017')\r\n\t\tthrower.should.throw('Unsupported relative time formatter input: string, Jan 14, 2017')\r\n\t})\r\n\r\n\tit('should return an empty string if the specified units are not available in locale data', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), { units: ['femtosecond'] }).should.equal('')\r\n\t})\r\n\r\n\tit('should format for a style with \"custom\" function', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// `custom` returns a string\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tcustom({ now, time, date, locale }) {\r\n\t\t\t\treturn locale\r\n\t\t\t}\r\n\t\t})\r\n\t\t.should.equal('en')\r\n\r\n\t\t// `custom` returns `undefined`\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tcustom({ now, time, date, locale }) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t})\r\n\t\t.should.equal('just now')\r\n\t})\r\n\r\n\tit('should format future dates', () => {\r\n\t\tnew TimeAgo('en').format(Date.now() + 60 * 60 * 1000).should.equal('in 1 hour')\r\n\t\tnew TimeAgo('ru').format(Date.now() + 60 * 1000).should.equal('через 1 минуту')\r\n\t})\r\n\r\n\tit('should accept \"future\" option', () => {\r\n\t\t// \"now\" unit.\r\n\t\tnew TimeAgo('en').format(Date.now()).should.equal('just now')\r\n\t\tnew TimeAgo('en').format(Date.now(), 'approximate', { future: true }).should.equal('in a moment')\r\n\r\n\t\t// Non-\"now\" unit, \"long\" style.\r\n\t\t// const style = {\r\n\t\t// \tgradation: [{\r\n\t\t// \t\tfactor: 1,\r\n\t\t// \t\tunit: 'second'\r\n\t\t// \t}],\r\n\t\t// \tlabels: 'long'\r\n\t\t// }\r\n\t\t// new TimeAgo('en').format(Date.now(), style).should.equal('0 seconds ago')\r\n\t\t// new TimeAgo('en').format(Date.now(), style, { future: true }).should.equal('in 0 seconds')\r\n\r\n\t\t// Non-\"now\" unit, \"mini\" style.\r\n\t\tconst style2 = {\r\n\t\t\tstyle: [{\r\n\t\t\t\tunit: 'year'\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini'\r\n\t\t}\r\n\t\tnew TimeAgo('ru').format(Date.now() - 5 * 365 * 24 * 60 * 60 * 1000, style2).should.equal('5 л')\r\n\t\tnew TimeAgo('ru').format(Date.now() - 5 * 365 * 24 * 60 * 60 * 1000, style2, { future: true }).should.equal('5 л')\r\n\t})\r\n\r\n\tit('should support the legacy properties: \"gradation\", \"flavour\", \"factor\", \"unit\", \"\\'tiny\\'\" labels style', () => {\r\n\t\t// Non-\"now\" unit, \"tiny\" style.\r\n\t\tconst style = {\r\n\t\t\tgradation: [{\r\n\t\t\t\tfactor: 5,\r\n\t\t\t\tunit: 'year'\r\n\t\t\t}],\r\n\t\t\tflavour: 'tiny'\r\n\t\t}\r\n\t\tnew TimeAgo('ru').format(Date.now() - 10 * 1000, style).should.equal('2 г')\r\n\t\tnew TimeAgo('ru').format(Date.now() - 10 * 1000, style, { future: true }).should.equal('2 г')\r\n\t})\r\n\r\n\tit('should have generated missing quantifier functions for locales that do not have it in CLDR data', () => {\r\n\t\tnew TimeAgo('ccp').format(Date.now() + 60 * 1000).should.equal('1 𑄟𑄨𑄚𑄨𑄘𑄬')\r\n\t})\r\n\r\n\tit('should throw for non-existing locales', () => {\r\n\t\t(() => TimeAgo.addLocale()).should.throw('No locale data passed')\r\n\t})\r\n\r\n\tit('should choose \"future\" variant of a label for `0` if \"future: true\" option is passed', () => {\r\n\t\tTimeAgo.addLocale(english)\r\n\t\tconst secondLabels = english['mini'].second\r\n\t\tenglish['mini'].second = {\r\n\t\t\tpast: '{0} seconds ago',\r\n\t\t\tfuture: 'in {0} seconds'\r\n\t\t}\r\n\r\n\t\tnew TimeAgo('en').format(Date.now(), {\r\n\t\t\tsteps: [{\r\n\t\t\t\tunit: 'second'\r\n\t\t\t}],\r\n\t\t\t// Uses \"mini\" labels so that it doesn't use `Intl.RelativeTimeFormat`.\r\n\t\t\tlabels: 'mini'\r\n\t\t}).should.equal('0 seconds ago')\r\n\r\n\t\tnew TimeAgo('en').format(Date.now(), {\r\n\t\t\tsteps: [{\r\n\t\t\t\tunit: 'second'\r\n\t\t\t}],\r\n\t\t\t// Uses \"mini\" labels so that it doesn't use `Intl.RelativeTimeFormat`.\r\n\t\t\tlabels: 'mini'\r\n\t\t}, {\r\n\t\t\tfuture: true\r\n\t\t}).should.equal('in 0 seconds')\r\n\r\n\t\tenglish['mini'].second = secondLabels\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// in 1 second -> in 0 seconds.\r\n\t\ttimeAgo.format(1000, 'twitter', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// in 1 second -> in 0 seconds.\r\n\t\ttimeAgo.format(1000, 'twitter', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t501\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (\"mini-now\" style) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// In 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t// Right after zero point.\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (\"mini-now\" style) (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\t// In 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 0\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t500 + 1\r\n\t\t])\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 500 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59.5 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59.5 * 1000 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t// Right after zero point.\r\n\t\t\t500\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t500\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t500 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 500\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (first step has non-zero \"minTime\") (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// Future.\r\n\t\t// Inside the first step.\r\n\t\t// Updates soon.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: -0.5 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t0.5 * 1000 + 1\r\n\t\t])\r\n\r\n\t\t// Future.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates right after zero point.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60 * 1000\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'',\r\n\t\t\t59 * 1000 + 1\r\n\t\t])\r\n\r\n\t\t// Zero point.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates at the first step's `minTime`.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'',\r\n\t\t\t60 * 1000\r\n\t\t])\r\n\r\n\t\t// Past.\r\n\t\t// Inside the first step.\r\n\t\t// Updates at the next minute.\r\n\t\ttimeAgo.format(60 * 1000, {\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'minute',\r\n\t\t\t\tminTime: 60\r\n\t\t\t}],\r\n\t\t\tlabels: 'mini',\r\n\t\t\tround: 'floor'\r\n\t\t}, {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 60 * 1000\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1m',\r\n\t\t\t60 * 1000\r\n\t\t])\r\n\r\n\t\t// Almost in 1 minute.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'59s',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// In 1 second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Almost in 1 second.\r\n\t\t// Updates right after the zero point.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 59 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: true`.\r\n\t\t// Updates right after zero point.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1\r\n\t\t])\r\n\t\t// Zero point (future to past).\r\n\t\t// `future: false`.\r\n\t\t// Updates at the next second.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000\r\n\t\t])\r\n\t\t// Right after zero point (past).\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'now',\r\n\t\t\t1000 - 1\r\n\t\t])\r\n\t\t// 1 second ago.\r\n\t\ttimeAgo.format(60 * 1000, 'mini-now', {\r\n\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\tnow: 60 * 1000 + 1000,\r\n\t\t\tround: 'floor'\r\n\t\t}).should.deep.equal([\r\n\t\t\t'1s',\r\n\t\t\t1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should pass `formatAs()` in `step.format()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(Date.now(), {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformat(date, locale, { formatAs }) {\r\n\t\t\t\t\treturn formatAs('second', 1)\r\n\t\t\t\t}\r\n\t\t\t}]\r\n\t\t}).should.equal('in 1 second')\r\n\t})\r\n\r\n\tit('should support `polyfill: false` option', () => {\r\n\t\tconst timeAgo = new TimeAgo('en', { polyfill: false })\r\n\t\t// Still uses \"now\" labels, even when not polyfilled.\r\n\t\ttimeAgo.format(0, 'round', { now: 0 }).should.equal('just now')\r\n\t\ttimeAgo.format(1000, 'round', { now: 0 }).should.equal('in 1 second')\r\n\t})\r\n\r\n\tit('should not use Intl.NumberFormat if it is not available', () => {\r\n\t\tconst Intl = global.Intl\r\n\t\tglobal.Intl = undefined\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(1000, 'round', { now: 0 }).should.equal('in 1 second')\r\n\t\tglobal.Intl = Intl\r\n\t})\r\n\r\n\tit('should format `0` in past mode by default', () => {\r\n\t\tnew TimeAgo('en').format(0, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'second'\r\n\t\t\t}]\r\n\t\t}, { now: 0 }).should.equal('0 seconds ago')\r\n\t})\r\n\r\n\tit('should format `0` in future mode when `future: true` option was passed', () => {\r\n\t\tnew TimeAgo('en').format(0, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{\r\n\t\t\t\tformatAs: 'second'\r\n\t\t\t}]\r\n\t\t}, { now: 0, future: true }).should.equal('in 0 seconds')\r\n\t})\r\n\r\n\tit('should throw if a step does not define `formatAs` or `format()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\texpect(() => timeAgo.format(Date.now() + 1000, {\r\n\t\t\tlabels: 'long',\r\n\t\t\tsteps: [{}]\r\n\t\t})).to.throw('Each step must define either `formatAs` or `format()`.')\r\n\t})\r\n\r\n\tit('should add default locale', () => {\r\n\t\tTimeAgo.getDefaultLocale().should.equal('en')\r\n\t\tTimeAgo.addDefaultLocale({\r\n\t\t\tlocale: 'el'\r\n\t\t})\r\n\t\tTimeAgo.getDefaultLocale().should.equal('el')\r\n\t\t// expect(() => {\r\n\t\t\tTimeAgo.addDefaultLocale({\r\n\t\t\t\tlocale: 'el'\r\n\t\t\t})\r\n\t\t// }).to.throw('`TimeAgo.addDefaultLocale()` can only be called once')\r\n\t\tTimeAgo.setDefaultLocale('en')\r\n\t})\r\n\r\n\tit('should support \"floor\" rounding', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(0.9 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('0s')\r\n\t\ttimeAgo.format(1 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1s')\r\n\t\ttimeAgo.format(1.9 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1s')\r\n\t\ttimeAgo.format(2 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('2s')\r\n\t\ttimeAgo.format(1.9 * 60 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('1m')\r\n\t\ttimeAgo.format(2 * 60 * 1000, 'twitter', { now: 0, round: 'floor' }).should.equal('2m')\r\n\t})\r\n})\r\n\r\ndescribe('isStyleObject', () => {\r\n\tit('should detect a style object', () => {\r\n\t\tisStyleObject({\r\n\t\t\tgradation: []\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tsteps: []\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tflavour: 'long'\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tflavour: ['long']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tlabels: 'long'\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tlabels: ['long']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tunits: ['now']\r\n\t\t}).should.equal(true)\r\n\t\tisStyleObject({\r\n\t\t\tfuture: true,\r\n\t\t\tround: 'floor',\r\n\t\t\tnow: 0,\r\n\t\t\tgetTimeToNextUpdate: true\r\n\t\t}).should.equal(false)\r\n\t\tisStyleObject('round').should.equal(false)\r\n\t})\r\n})"],"file":"TimeAgo.test.js"}
@@ -512,7 +512,7 @@ TimeAgo.setDefaultLocale = function (locale) {
512
512
 
513
513
  TimeAgo.addDefaultLocale = function (localeData) {
514
514
  if (defaultLocaleHasBeenSpecified) {
515
- throw new Error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.');
515
+ return console.error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.');
516
516
  }
517
517
 
518
518
  defaultLocaleHasBeenSpecified = true;