Class TimeUnit
Extends
Measurement.
Create a new time measurement instance.
Defined in: TimeUnit.js.
Constructor Attributes | Constructor Name and Description |
---|---|
TimeUnit(options)
|
Method Attributes | Method Name and Description |
---|---|
<static> |
TimeUnit.convert(to, from, time)
Convert a time to another measure.
|
Return the type of this measurement.
|
|
newUnit(params)
Return a new instance of this type of measurement.
|
Class Detail
TimeUnit(options)
- Parameters:
- options
- {{unit:string,amount:number|string|undefined}} Options controlling the construction of this instance
Method Detail
<static>
{number|undefined}
TimeUnit.convert(to, from, time)
Convert a time to another measure.
- Parameters:
- to
- {string} unit to convert to
- from
- {string} unit to convert from
- time
- {number} amount to be convert
- Returns:
- {number|undefined} the converted amount
{string}
getMeasure()
Return the type of this measurement. Examples are "mass",
"length", "speed", etc. Measurements can only be converted
to measurements of the same type.
The type of the units is determined automatically from the units. For example, the unit "grams" is type "mass". Use the static call Measurement.getAvailableUnits to find out what units this version of ilib supports.
- Returns:
- {string} the name of the type of this measurement
{Measurement}
newUnit(params)
Return a new instance of this type of measurement.
- Parameters:
- {Object} params
- parameters to the constructor
- Returns:
- {Measurement} a measurement subclass instance