WowAddons

World of Warcraft Forever API · SecondsFormatterAPI.md, for your AI

SecondsFormatterAPI (widget methods)

35 functions, as Blizzard documents them for Forever 1.60.1 (70959).

Making an addon with an AI? Tell it: Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it. It checks every call against this API before you try it in the game, then publishes it here. How it works.

Functions

CanApproximate

canApproximate = self:CanApproximate(seconds)

Returns true if the given number of seconds is within an appropriate range for approximated formatting.

Arguments

secondsSeconds

Returns

canApproximatebool

CanRoundUpIntervals

canRound = self:CanRoundUpIntervals()

Returns true if the formatter can promote values to higher interval bands.

Returns

canRoundbool

CanRoundUpLastUnit

canRound = self:CanRoundUpLastUnit()

Returns true if the formatter should round the final unit up rather than down.

Returns

canRoundbool

EvaluateDesiredUnitCount

count = self:EvaluateDesiredUnitCount(seconds)

Returns the unit count that a given number of seconds will use for formatting.

Arguments

secondsSeconds

Returns

countnumber

EvaluateMaxInterval

interval = self:EvaluateMaxInterval(seconds)

Returns the maximum interval band that a given number of seconds will use for formatting.

Arguments

secondsSeconds

Returns

intervalSecondsFormatterInterval

EvaluateMinInterval

interval = self:EvaluateMinInterval(seconds)

Returns the minimum interval band that a given number of seconds will use for formatting.

Arguments

secondsSeconds

Returns

intervalSecondsFormatterInterval

Format

formattedSeconds = self:Format(seconds, [abbreviation])

Formats a number of seconds and returns the resulting string.

Arguments

secondsSeconds
abbreviationSecondsFormatterAbbreviation may be nilOptional abbreviation mode to use in-place of the default.

Returns

formattedSecondsstring

FormatZero

formattedSeconds = self:FormatZero([abbreviation])

Returns formatted string representing a zero second duration.

Arguments

abbreviationSecondsFormatterAbbreviation may be nilOptional abbreviation mode to use in-place of the default.

Returns

formattedSecondsstring

GetApproximationSeconds

approximationSeconds = self:GetApproximationSeconds()

Returns the threshold below which numeric values are formatted as approximated strings.

Returns

approximationSecondsSeconds

GetConvertToLower

convert = self:GetConvertToLower()

Returns true if the formatter should lowercase all unit format strings.

Returns

convertbool

GetDefaultAbbreviation

abbreviation = self:GetDefaultAbbreviation()

Returns the default abbreviation mode used for formatting.

Returns

abbreviationSecondsFormatterAbbreviation may be nil

GetDesiredUnitCount

count = self:GetDesiredUnitCount()

Returns the desired unit count for formatting.

Returns

countnumber may be nilNil if configured to use a curve.

GetDesiredUnitCountCurve

curve = self:GetDesiredUnitCountCurve()

Returns the desired unit count curve for formatting.

Returns

curveLuaCurveObject may be nilNil if configured to static unit count.

GetMaxInterval

interval = self:GetMaxInterval()

Returns the maximum interval band permitted for formatting.

Returns

intervalSecondsFormatterInterval may be nilNil if configured to use a curve.

GetMaxIntervalCurve

curve = self:GetMaxIntervalCurve()

Returns the maximum interval band curve permitted for formatting.

Returns

curveLuaCurveObject may be nilNil if configured to static interval band.

GetMillisecondsThreshold

threshold = self:GetMillisecondsThreshold()

Returns the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')

Returns

thresholdSeconds

GetMinInterval

interval = self:GetMinInterval()

Returns the minimum interval band permitted for formatting.

Returns

intervalSecondsFormatterInterval may be nilNil if configured to use a curve.

GetMinIntervalCurve

curve = self:GetMinIntervalCurve()

Returns the minimum interval band curve permitted for formatting.

Returns

curveLuaCurveObject may be nilNil if configured to static interval band.

GetRounding

rounding = self:GetRounding()

Returns how fractional seconds are rounded when not displaying milliseconds.

Returns

roundingSecondsFormatterRoundingThe configured rounding mode.

GetStripIntervalWhitespace

strip = self:GetStripIntervalWhitespace()

Returns the whitespace stripping mode of the formatter.

Returns

stripSecondsFormatterIntervalWhitespace

Reset

self:Reset()

Resets all stored configuration of the formatter.

SetApproximationSeconds

self:SetApproximationSeconds(seconds)

Configures the formatter to render numeric values between zero and this value as approximated strings (eg. '< 1m').

Arguments

secondsSeconds

SetCanRoundUpIntervals

self:SetCanRoundUpIntervals(canRound)

Configures the formatter to promote intervals if values are large enough (eg. '60m' -> '1h').

Arguments

canRoundbool

SetCanRoundUpLastUnit

self:SetCanRoundUpLastUnit(canRound)

Configures the formatter to round the last formatted unit up, rather than down.

Arguments

canRoundbool

SetConvertToLower

self:SetConvertToLower(convert)

Configures the formatter to convert all interval format strings to lowercase.

Arguments

convertbool

SetDefaultAbbreviation

self:SetDefaultAbbreviation(abbreviation)

Sets the default abbreviation mode used for formatting.

Arguments

abbreviationSecondsFormatterAbbreviation

SetDesiredUnitCount

self:SetDesiredUnitCount(count)

Sets the desired unit count used for formatting.

Arguments

countnumber

SetDesiredUnitCountCurve

self:SetDesiredUnitCountCurve(curve)

Sets the desired unit count used for formatting to a curve that will be evaluated with seconds values to produce a desired unit count.

Arguments

curveLuaCurveObject

SetMaxInterval

self:SetMaxInterval(interval)

Sets the maximum interval band used for formatting.

Arguments

intervalSecondsFormatterInterval

SetMaxIntervalCurve

self:SetMaxIntervalCurve(curve)

Sets the maximum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.

Arguments

curveLuaCurveObject

SetMillisecondsThreshold

self:SetMillisecondsThreshold(threshold)

Sets the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')

Arguments

thresholdSeconds

SetMinInterval

self:SetMinInterval(interval)

Sets the minimum interval band used for formatting.

Arguments

intervalSecondsFormatterInterval

SetMinIntervalCurve

self:SetMinIntervalCurve(curve)

Sets the minimum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.

Arguments

curveLuaCurveObject

SetRounding

self:SetRounding(rounding)

Sets how fractional seconds are rounded when not displaying milliseconds.

Arguments

roundingSecondsFormatterRoundingThe rounding mode to use.

SetStripIntervalWhitespace

self:SetStripIntervalWhitespace(strip)

Sets the whitespace stripping mode for the formatter.

Arguments

stripSecondsFormatterIntervalWhitespace

It takes WowAddons

Free, for Windows, macOS and Linux: it puts the addon in your game in one click and keeps it up to date. Open it once, then press Install again.

WowAddons runs on your computer: open wowaddons.gg there.

Download for Windows