• Public
  • Public/Protected
  • All

Interface BaseTimeUnit

This interface is a base time unit definition, consisting of linguistic-related properties pertaining to the time unit being described.

Mathematical properties are left out of this interface in order to allow better control over configurations (and since time units have the same mathematical constants regardless of language).




Optional customPlural

customPlural: string | NumericWriter

Defines a custom pluralized name for the time unit; it can be a string — used whenever the quantity of time is greater than one — or a function, able to retrieve different words according to a given quantity.

By default, words are pluralized by adding an "s" to the end of their readable name.

Optional pluralize

pluralize: undefined | false | true

Determines whether the time unit should be pluralized: by default, words are pluralized by adding an "s" to the end of their readable name, but this can be changed via customPlural.

If set to false, this will prevent the time unit from ever being pluralized (unless this configuration is overwritten).

Optional readableName

readableName: undefined | string

Name of the time unit presented in a human readable format.

For timecount's default language — English (US) — this is parsed from the name of the property that contains the time unit, taking advantage of its medial capitals to separate compound names (galacticYear parses as "galactic year").

In some cases, however, a custom readable name is required even in English (US) (planckTime, for example, would not be correctly capitalized as "Planck time").

If you wish to help timecount with a translation, plese consult Contributing: Translating.

Optional symbol

symbol: undefined | string

A symbol representing the time unit (e.g. "s" for seconds).

Generated using TypeDoc