META-INF.resources.bower_components.globalize.dist.globalize-runtime.relative-time.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
The newest version!
(function(root,factory){if(typeof define==="function"&&define.amd){define(["../globalize-runtime","./number","./plural"],factory)}else if(typeof exports==="object"){module.exports=factory(require("../globalize-runtime"),require("./number"),require("./plural"))}else{factory(root.Globalize)}})(this,function(Globalize){var formatMessage=Globalize._formatMessage,runtimeKey=Globalize._runtimeKey,validateParameterPresence=Globalize._validateParameterPresence,validateParameterTypeNumber=Globalize._validateParameterTypeNumber;var relativeTimeFormat=function(value,numberFormatter,pluralGenerator,properties){var relativeTime,message=properties["relative-type-"+value];if(message){return message}relativeTime=value<=0?properties["relativeTime-type-past"]:properties["relativeTime-type-future"];value=Math.abs(value);message=relativeTime["relativeTimePattern-count-"+pluralGenerator(value)];return formatMessage(message,[numberFormatter(value)])};var relativeTimeFormatterFn=function(numberFormatter,pluralGenerator,properties){return function relativeTimeFormatter(value){validateParameterPresence(value,"value");validateParameterTypeNumber(value,"value");return relativeTimeFormat(value,numberFormatter,pluralGenerator,properties)}};Globalize._relativeTimeFormatterFn=relativeTimeFormatterFn;Globalize.formatRelativeTime=Globalize.prototype.formatRelativeTime=function(value,unit,options){validateParameterPresence(value,"value");validateParameterTypeNumber(value,"value");return this.relativeTimeFormatter(unit,options)(value)};Globalize.relativeTimeFormatter=Globalize.prototype.relativeTimeFormatter=function(unit,options){options=options||{};return Globalize[runtimeKey("relativeTimeFormatter",this._locale,[unit,options])]};return Globalize});