The abstract operation InitializeUnitFormat accepts the arguments unitFormat (which must be an object), locales, and options. It initializes unitFormat as a UnitFormat object. It performs the following steps:
Type | Unit |
---|---|
duration | century |
year | |
month | |
week | |
day | |
hour | |
minute | |
second | |
millisecond | |
microsecond | |
nanosecond | |
length | kilometer |
meter | |
decimeter | |
centimeter | |
milimeter | |
micrometer | |
nanometer | |
picometer | |
mile | |
yard | |
foot | |
inch | |
parsec | |
light-year | |
astronomical-unit | |
furlong | |
fathom | |
nautical-mile | |
mile-scandinavian | |
area | square-kilometer |
hectare | |
square-meter | |
square-centimeter | |
square-mile | |
acre | |
square-yard | |
square-foot | |
square-inch | |
volume | cubic-kilometer |
cubic-meter | |
cubic-centimeter | |
cubic-mile | |
cubic-yard | |
cubic-foot | |
cubic-inch | |
megaliter | |
hectoliter | |
liter | |
deciliter | |
centiliter | |
milliliter | |
pint-metric | |
cup-metric | |
acre-foot | |
bushel | |
gallon | |
gallon-imperial | |
quart | |
pint | |
cup | |
fluid-ounce | |
tablespoon | |
teaspoon | |
speed-and-acceleration | g-force |
meter-per-second-squared | |
kilometer-per-hour | |
meter-per-second | |
mile-per-hour | |
knot | |
mass-and-weight | metric-ton |
kilogram | |
gram | |
milligram | |
microgram | |
ton | |
stone | |
pound | |
ounce | |
ounce-troy | |
carat | |
energy-and-power | kilocalorie |
calorie | |
foodcalorie | |
kilojoule | |
joule | |
kilowatt-hour | |
gigawatt | |
megawatt | |
kilowatt | |
watt | |
milliwatt | |
horsepower | |
electrical-and-frequency | ampere |
milliampere | |
ohm | |
volt | |
gigahertz | |
megahertz | |
kilohertz | |
weather | hectopascal |
millimeter-of-mercury | |
pound-per-square-inch | |
inch-hg | |
millibar | |
generic | |
celsius | |
fahrenheit | |
kelvin | |
digital | terabyte |
terabit | |
gigabyte | |
gigabit | |
megabyte | |
megabit | |
kilobyte | |
kilobit | |
byte | |
bit | |
coordinates | east |
north | |
south | |
west | |
other-units | radian |
degree | |
arc-minute | |
arc-second | |
karat | |
milligram-per-deciliter | |
millimole-per-liter | |
liter-per-kilometer | |
liter-per-100kilometers | |
mile-per-gallon | |
mile-per-gallon-imperial | |
lux |
The
Input: DeconstructPattern("AA{xx}BB{yy}CC", { xx: {type: 'hour', value: '15'}, yy: {type: 'minute', value: '06'} }); Output: [ {type: 'literal', value: 'AA'}, {type: 'hour', value: '15'}, {type: 'literal', value: 'BB'}, {type: 'minute', value: '06'}, {type: 'literal', value: 'CC'} ]
The
The FormatUnit abstract operation is called with arguments unitFormat (which must be an object initialized as a UnitFormat) and list (which must be an Array), and performs the following steps:
The FormatUnitToParts abstract operation is called with arguments unitFormat (which must be an object initialized as a UnitFormat) and value (which must be a Number), and performs the following steps:
The UnitFormat constructor is a standard built-in property of the Intl object. Behaviour common to all service constructor properties of the Intl object is specified in
When the
The Intl.UnitFormat constructor has the following properties:
The value of
This property has the attributes { [[Writable]]:
When the
The value of the
The value of the [[relevantExtensionKeys]] internal slot is [].
The value of the [[availableLocales]] internal slot is implementation defined within the constraints described in
The value of the [[localeData]] internal slot is implementation defined within the constraints described in
The Intl.UnitFormat prototype object is itself an Intl.UnitFormat instance as specified in
In the following descriptions of functions that are properties or [[Get]] attributes of properties of
The initial value of
The initial value of the @@toStringTag property is the string value
This property has the attributes { [[Writable]]:
Intl.UnitFormat.prototype.format is an accessor property whose set accessor function is
Intl.UnitFormat.prototype.format is an accessor property whose set accessor function is
This function provides access to the locale and options computed during initialization of the object.
The function returns a new object whose properties and attributes are set as if constructed by an object literal assigning to each of the following properties the value of the corresponding internal slot of this UnitFormat object (see
Intl.UnitFormat instances inherit properties from
Intl.UnitFormat instances and other objects that have been successfully initialized as a UnitFormat have [[initializedIntlObject]] and [[initializedUnitFormat]] internal slots whose values are
Objects that have been successfully initialized as a UnitFormat object also have several internal slots that are computed by the constructor:
Finally, objects that have been successfully initialized as a UnitFormat have a [[boundResolve]] internal slot that caches the function returned by the format accessor (
© 2017 Mozilla, Ecma International
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.