options

Namespace

options

Description:
  • Default options for different IO types Not all methods make use of all settings.

Members

(static) break :"alwaysBreak"|"auto"|"avoidBreak"|"neverBreak"

Description:
  • Whitespace formatting (uses HTML!)
Default Value:
  • neuter
Whitespace formatting (uses HTML!)
Type:
  • "alwaysBreak" | "auto" | "avoidBreak" | "neverBreak"

(static) calendar :"buddhist"|"chinese"|"coptic"|"dangi"|"ethiopic"|"ethiopicAmeteAlem"|"gregorian"|"hebrew"|"indian"|"islamic"|"islamicCivil"|"islamicRgsa"|"islamicTbla"|"islamicUmalqura"|"iso8601"|"japanese"|"persian"|"roc"

Description:
  • A calendar system.
A calendar system.
Type:
  • "buddhist" | "chinese" | "coptic" | "dangi" | "ethiopic" | "ethiopicAmeteAlem" | "gregorian" | "hebrew" | "indian" | "islamic" | "islamicCivil" | "islamicRgsa" | "islamicTbla" | "islamicUmalqura" | "iso8601" | "japanese" | "persian" | "roc"

(static) conjugation :string

Description:
  • In methods using translation tables, use this conjugation
In methods using translation tables, use this conjugation
Type:
  • string

(static) decimalDigits :number

Description:
  • How many decimal digits should we display?
Default Value:
  • 1
How many decimal digits should we display?
Type:
  • number

(static) denominator :number|'pretty'

Description:
  • Keep the denominator in a fraction below this
Default Value:
  • "pretty"
Keep the denominator in a fraction below this
Type:
  • number | 'pretty'

(static) forceDecimalDigits :boolean

Description:
  • Should trailing zeros be kept/added to force an exakt number of decimals?
    If textfunctions is loaded in the global namespace, you can use number(2.0, {forceDecimalDigits}) as a shortcut for number(2.0, {forceDecimalDigits: true})
Default Value:
  • false
Should trailing zeros be kept/added to force an exakt number of decimals?
If textfunctions is loaded in the global namespace, you can use number(2.0, {forceDecimalDigits}) as a shortcut for number(2.0, {forceDecimalDigits: true})
Type:
  • boolean

(static) forceDenominator :boolean

Description:
  • Should the denominator of a fraction always be forced to a given value?
Default Value:
  • false
Should the denominator of a fraction always be forced to a given value?
Type:
  • boolean

(static) forcePrecision :boolean

Description:
  • Should we enforce the precision rule, even if it means erasing any meaningful information?
Default Value:
  • false
Should we enforce the precision rule, even if it means erasing any meaningful information?
Type:
  • boolean

(static) form :"adjunct"|"nominative"|"genitive"|"accusative"|"dative"|"locative"|"ablative"|"instrumental"|"objective"|"vocative"|"translative"|"terminative"|"illative"|"adessive"|"sublative"|"superessive"|"delative"|"temporal"|"sociative"|"prepositional"|"compound"

Description:
  • A grammatical form, e.g. a case. Used in territory functions.
Default Value:
  • nominative
A grammatical form, e.g. a case. Used in territory functions.
Type:
  • "adjunct" | "nominative" | "genitive" | "accusative" | "dative" | "locative" | "ablative" | "instrumental" | "objective" | "vocative" | "translative" | "terminative" | "illative" | "adessive" | "sublative" | "superessive" | "delative" | "temporal" | "sociative" | "prepositional" | "compound"

(static) formatters :object

Description:
  • Formatting methods to use internally. Currently used in list functions for advanced use cases, like when different parts of a list should be formatted differently.
Default Value:
  • {}
Formatting methods to use internally. Currently used in list functions for advanced use cases, like when different parts of a list should be formatted differently.
Type:
  • object

(static) gender :"neuter"|"reale"|"masculine"|"feminine"|"other"

Description:
  • A grammatical gender
Default Value:
  • neuter
A grammatical gender
Type:
  • "neuter" | "reale" | "masculine" | "feminine" | "other"

(static) glue :string

Description:
  • Special word to use in e.g. lists (the “nor” in “a, b, nor c”)
Default Value:
  • undefined
Special word to use in e.g. lists (the “nor” in “a, b, nor c”)
Type:
  • string

(static) key :string

Description:
  • If we are passing an array of objects, use this key of each object
If we are passing an array of objects, use this key of each object
Type:
  • string

(static) largeNumberLimit :number

Description:
  • From what limit should large numbers use special textual representation? Defaults vary by language, e.g. millions for most European languages, and tenthousands for most Eastasian languages. The language defaults may or may not be suitable in you specific case.
From what limit should large numbers use special textual representation? Defaults vary by language, e.g. millions for most European languages, and tenthousands for most Eastasian languages. The language defaults may or may not be suitable in you specific case.
Type:
  • number

(static) largestUnit :string

Description:
  • Largest units to use when mixing units, in e.g. `duration()` Default will vary from case to case.
Default Value:
  • undefined
Largest units to use when mixing units, in e.g. `duration()` Default will vary from case to case.
Type:
  • string

(static) level :number|null

Description:
  • In nested lists, parentheses or the like, languages can prefer to use different characters for different nesting levels. For instance, the semi colon might replace the comma in a level 2 list. null means auto-detect Outer shells have higher number.
Default Value:
  • null
In nested lists, parentheses or the like, languages can prefer to use different characters for different nesting levels. For instance, the semi colon might replace the comma in a level 2 list. null means auto-detect Outer shells have higher number.
Type:
  • number | null

(static) magnitude :number

Description:
  • Denotes an order of magnitude, by number of zeroes. A magnitude of 6 means that something should be counted in millions.
Denotes an order of magnitude, by number of zeroes. A magnitude of 6 means that something should be counted in millions.
Type:
  • number

(static) name :string

Description:
  • An identifier Used only to group footnotes.
Default Value:
  • 0
An identifier Used only to group footnotes.
Type:
  • string

(static) numberSystem :"adlm"|"ahom"|"arab"|"arabext"|"armn"|"armnlow"|"bali"|"beng"|"bhks"|"brah"|"cakm"|"cham"|"cyrl"|"deva"|"ethi"|"fullwide"|"geor"|"gong"|"gonm"|"grek"|"greklow"|"gujr"|"guru"|"hanidays"|"hanidec"|"hans"|"hansfin"|"hant"|"hantfin"|"hebr"|"hmng"|"hmnp"|"java"|"jpan"|"jpanfin"|"jpanyear"|"kali"|"khmr"|"knda"|"lana"|"lanatham"|"laoo"|"latn"|"lepc"|"limb"|"mathbold"|"mathdbl"|"mathmono"|"mathsanb"|"mathsans"|"mlym"|"modi"|"mong"|"mroo"|"mtei"|"mymr"|"mymrshan"|"mymrtlng"|"newa"|"nkoo"|"olck"|"orya"|"osma"|"rohg"|"roman"|"romanlow"|"saur"|"shrd"|"sind"|"sinh"|"sora"|"sund"|"takr"|"talu"|"taml"|"tamldec"|"telu"|"thai"|"tirh"|"tibt"|"vaii"|"wara"|"wcho"

Description:
  • A number system. Will default to the default decimal system of the current locale, eg 'latn' or 'arab'.
A number system. Will default to the default decimal system of the current locale, eg 'latn' or 'arab'.
Type:
  • "adlm" | "ahom" | "arab" | "arabext" | "armn" | "armnlow" | "bali" | "beng" | "bhks" | "brah" | "cakm" | "cham" | "cyrl" | "deva" | "ethi" | "fullwide" | "geor" | "gong" | "gonm" | "grek" | "greklow" | "gujr" | "guru" | "hanidays" | "hanidec" | "hans" | "hansfin" | "hant" | "hantfin" | "hebr" | "hmng" | "hmnp" | "java" | "jpan" | "jpanfin" | "jpanyear" | "kali" | "khmr" | "knda" | "lana" | "lanatham" | "laoo" | "latn" | "lepc" | "limb" | "mathbold" | "mathdbl" | "mathmono" | "mathsanb" | "mathsans" | "mlym" | "modi" | "mong" | "mroo" | "mtei" | "mymr" | "mymrshan" | "mymrtlng" | "newa" | "nkoo" | "olck" | "orya" | "osma" | "rohg" | "roman" | "romanlow" | "saur" | "shrd" | "sind" | "sinh" | "sora" | "sund" | "takr" | "talu" | "taml" | "tamldec" | "telu" | "thai" | "tirh" | "tibt" | "vaii" | "wara" | "wcho"
Example
numberSystem.allowed.map(x => [x, number(123, {numberSystem: x})])
[
  [ 'adlm', '𞥑𞥒𞥓' ],
  [ 'ahom', '𑜱𑜲𑜳' ],
  [ 'arab', '١٢٣' ],
  [ 'arabext', '۱۲۳' ],
  [ 'armn', 'ՃԻԳ' ],
  [ 'armnlow', 'ճիգ' ],
  [ 'bali', '᭑᭒᭓' ],
  [ 'beng', '১২৩' ],
  [ 'bhks', '𑱑𑱒𑱓' ],
  [ 'brah', '𑁧𑁨𑁩' ],
  [ 'cakm', '𑄷𑄸𑄹' ],
  [ 'cham', '꩑꩒꩓' ],
  [ 'cyrl', 'рк҃г' ],
  [ 'deva', '१२३' ],
  [ 'diak', '𑥑𑥒𑥓'],
  [ 'ethi', '፻፳፫' ],
  [ 'fullwide', '123' ],
  [ 'geor', 'რკგ' ],
  [ 'gong', '𑶡𑶢𑶣' ],
  [ 'gonm', '𑵑𑵒𑵓' ],
  [ 'grek', 'ΡΚΓ´' ],
  [ 'greklow', 'ρκγ´' ],
  [ 'gujr', '૧૨૩' ],
  [ 'guru', '੧੨੩' ],
  [ 'hanidays', '一百二十三' ],
  [ 'hanidec', '一二三' ],
  [ 'hans', '一百二十三' ],
  [ 'hansfin', '壹佰贰拾叁' ],
  [ 'hant', '一百二十三' ],
  [ 'hantfin', '壹佰貳拾參' ],
  [ 'hebr', 'קכ״ג' ],
  [ 'hmng', '𖭑𖭒𖭓' ],
  [ 'hmnp', '𞅁𞅂𞅃' ],
  [ 'java', '꧑꧒꧓' ],
  [ 'jpan', '百二十三' ],
  [ 'jpanfin', '壱百弐拾参' ],
  [ 'jpanyear', '123' ],
  [ 'kali', '꤁꤂꤃' ],
  [ 'khmr', '១២៣' ],
  [ 'knda', '೧೨೩' ],
  [ 'lana', '᪁᪂᪃' ],
  [ 'lanatham', '᪑᪒᪓' ],
  [ 'laoo', '໑໒໓' ],
  [ 'latn', '123' ],
  [ 'lepc', '᱁᱂᱃' ],
  [ 'limb', '᥇᥈᥉' ],
  [ 'mathbold', '𝟏𝟐𝟑' ],
  [ 'mathdbl', '𝟙𝟚𝟛' ],
  [ 'mathmono', '𝟷𝟸𝟹' ],
  [ 'mathsanb', '𝟭𝟮𝟯' ],
  [ 'mathsans', '𝟣𝟤𝟥' ],
  [ 'mlym', '൧൨൩' ],
  [ 'modi', '𑙑𑙒𑙓' ],
  [ 'mong', '᠑᠒᠓' ],
  [ 'mroo', '𖩡𖩢𖩣' ],
  [ 'mtei', '꯱꯲꯳' ],
  [ 'mymr', '၁၂၃' ],
  [ 'mymrshan', '႑႒႓' ],
  [ 'mymrtlng', '꧱꧲꧳' ],
  [ 'newa', '𑑑𑑒𑑓' ],
  [ 'nkoo', '߁߂߃' ],
  [ 'olck', '᱑᱒᱓' ],
  [ 'orya', '୧୨୩' ],
  [ 'osma', '𐒡𐒢𐒣' ],
  [ 'rohg', '𐴱𐴲𐴳' ],
  [ 'roman', 'CXXIII' ],
  [ 'romanlow', 'cxxiii' ],
  [ 'saur', '꣑꣒꣓' ],
  [ 'shrd', '𑇑𑇒𑇓' ],
  [ 'sind', '𑋱𑋲𑋳' ],
  [ 'sinh', '෧෨෩' ],
  [ 'sora', '𑃱𑃲𑃳' ],
  [ 'sund', '᮱᮲᮳' ],
  [ 'takr', '𑛁𑛂𑛃' ],
  [ 'talu', '᧑᧒᧓' ],
  [ 'taml', '௱௨௰௩' ],
  [ 'tamldec', '௧௨௩' ],
  [ 'telu', '౧౨౩' ],
  [ 'thai', '๑๒๓' ],
  [ 'tirh', '𑓑𑓒𑓓' ],
  [ 'tibt', '༡༢༣' ],
  [ 'vaii', '꘡꘢꘣' ],
  [ 'wara', '𑣡𑣢𑣣' ],
  [ 'wcho', '𞋱𞋲𞋳' ]
]

(static) precision :number

Description:
  • Should we round the number to a certain precision? 1_000 means “round to nearest thousands”, etc. A nullish value means “don't round”
Default Value:
  • 0
Should we round the number to a certain precision? 1_000 means “round to nearest thousands”, etc. A nullish value means “don't round”
Type:
  • number

(static) prettyLimit :number

Description:
  • For pretty-methods: Below what limit should numbers be spelled-out?
    Defaults vary by language. Note that under most modern styleguides, the choice of words or digits is highly dependent on context. The language defaults may not be suitable in you specific case.
For pretty-methods: Below what limit should numbers be spelled-out?
Defaults vary by language. Note that under most modern styleguides, the choice of words or digits is highly dependent on context. The language defaults may not be suitable in you specific case.
Type:
  • number

(static) relativeLimit :number

Description:
  • When (if ever) should relative date functions start using absolute values (e.g. April 1998 rather than the less readable April 26 years ago?)
Default Value:
  • undefined
When (if ever) should relative date functions start using absolute values (e.g. April 1998 rather than the less readable April 26 years ago?)
Type:
  • number

(static) significantDigits :number

Description:
  • Like precision, but for the number of significant digits
Like precision, but for the number of significant digits
Type:
  • number

(static) smallestUnit :string

Description:
  • Smallest unit to include when mixing units, in e.g. `duration()` Default will vary from case to case.
Default Value:
  • undefined
Smallest unit to include when mixing units, in e.g. `duration()` Default will vary from case to case.
Type:
  • string

(static) style :"format"|"standAlone"|"noun"|"article"|"default"|"informal"|"range"|"legal"|"council"

Description:
  • A style for a part of a phrase, e.g. a date component. For instance, some languages use different styles for month and/or weekday names, depending on whether they are used to construct a date (format), or not (standAlone).
    Unlike variant, style is always a method specific, closed set of values.
Default Value:
  • default
A style for a part of a phrase, e.g. a date component. For instance, some languages use different styles for month and/or weekday names, depending on whether they are used to construct a date (format), or not (standAlone).
Unlike variant, style is always a method specific, closed set of values.
Type:
  • "format" | "standAlone" | "noun" | "article" | "default" | "informal" | "range" | "legal" | "council"
Examples

fi

// returns 'heinäkuu'
monthFromNumber(6, {style: "default"})
// returns 'heinäkuuta'
monthFromNumber(6, {style: "format"})

sv

// returns 'den 3 januari'
dayMonth("2022-01-03", {style: "article"})

(static) tzOffset :number

Description:
  • Force a time to be shown with an offset, relative the timezone used. Mostly for backwards compatibility, as all time-related methods now accept full, timezoned timestamps, and even Temporal objects.
Default Value:
  • 0
Force a time to be shown with an offset, relative the timezone used. Mostly for backwards compatibility, as all time-related methods now accept full, timezoned timestamps, and even Temporal objects.
Type:
  • number

(static) variant :string

Description:
  • A variant of a word or phrase This is similar to style, but where style denotes a well-defined use case among a closed set of alternatives, variant is a an open class of words. Methods may accept examples words, to select a variant (see .bearing() for an example).
Default Value:
  • variant
A variant of a word or phrase This is similar to style, but where style denotes a well-defined use case among a closed set of alternatives, variant is a an open class of words. Methods may accept examples words, to select a variant (see .bearing() for an example).
Type:
  • string
Example

sv

// returns 'sydlig'
bearing(182, {variant: "nordlig"})

(static) weekStartsAt :string|number

Description:
  • Specify the starting day of the week. This is normally derived from the locale, but some locale settings are ambigous. This option is used in methods like `relativeWeek()`. If your locale does not include a territory, the default territory for your language will be used. In case of ambiguity, an error will be thrown. In other words: `sv` will work, becuase in all of the Swedish' default territories AX, FI, and SE the week starts on Monday, but `en` will fail, because in some `en` territories the week starts on Sunday and in others on Monday. It's recommended to be specific in your locale settings to avoid ambiguity, but if that's not an option you can also pass the `weekStartsAt` option.
Default Value:
  • undefined
Specify the starting day of the week. This is normally derived from the locale, but some locale settings are ambigous. This option is used in methods like `relativeWeek()`. If your locale does not include a territory, the default territory for your language will be used. In case of ambiguity, an error will be thrown. In other words: `sv` will work, becuase in all of the Swedish' default territories AX, FI, and SE the week starts on Monday, but `en` will fail, because in some `en` territories the week starts on Sunday and in others on Monday. It's recommended to be specific in your locale settings to avoid ambiguity, but if that's not an option you can also pass the `weekStartsAt` option.
Type:
  • string | number

(static) zeroSign :number|string

Description:
  • Should 0 be considered positive, negative, or neither? -1, 0, or 1
Default Value:
  • 0
Should 0 be considered positive, negative, or neither? -1, 0, or 1
Type:
  • number | string