How to use the relative-time-format.setDefaultLocale function in relative-time-format

To help you get started, we’ve selected a few relative-time-format examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catamphetamine / javascript-time-ago / source / JavascriptTimeAgo.js View on Github external
// Can't happen - "long" flavour is always present.
		// throw new Error(`None of the flavours - ${flavour.join(', ')} - was found for locale "${this.locale}".`)
	}
}

/**
 * Gets default locale.
 * @return  {string} locale
 */
JavascriptTimeAgo.getDefaultLocale = RelativeTimeFormat.getDefaultLocale

/**
 * Sets default locale.
 * @param  {string} locale
 */
JavascriptTimeAgo.setDefaultLocale = RelativeTimeFormat.setDefaultLocale

/**
 * Adds locale data for a specific locale.
 * @param {Object} localeData
 */
JavascriptTimeAgo.addLocale = function(localeData) {
	addLocaleData(localeData)
	RelativeTimeFormat.addLocale(localeData)
}

/**
 * (legacy alias)
 * Adds locale data for a specific locale.
 * @param {Object} localeData
 * @deprecated
 */