Easily convert unit from and to the international system of units and automatically get the localization for it.
How it work
Conversions
This package use extension on num
to allow you to convert easily from one unit to another.
For example if you want to transform celsius to fahrenheit here is the code:
0.toKelvin(TemperatureUnit.celsius).toFahrenheit;
Localization
We take care of the localization of the unit for you as an example on length this code will be localized:
isLocalizations.length.locale(12, UnitSystem.international); // 0.012 km
This is due to the fact that international system base unit for length is the meters.
What we support currently
Converstions
Area
The base unit for area is square meter.
x
to/from square centimetersx
to/from square kilometersx
to/from square milesx
to/from square yardx
to/from square footx
to/from square inchesx
to/from hectarex
to/from acre
Length
The base unit for length is meter.
x
to/from nanometersx
to/from micrometersx
to/from millimetersx
to/from centimetersx
to/from kilometersx
to/from inchx
to/from footx
to/from yardx
to/from milesx
to/from nautical miles
Length Per Time (speed)
The base unit for length per time is meters per seconds.
x
to/from knotx
to/from kilometers per hoursx
to/from miles per hours
Length Per Volume
The base unit for length per volume is meters per liters.
x
to/from kilometers per litersx
to/from miles per us gallonsx
to/from miles per imperial gallons
Mass
The base unit for mass is kilograms.
x
to/from tonsx
to/from milligramsx
to/from microgramsx
to/from gramsx
to/from imperial tonx
to/from us tonx
to/from stonex
to/from poundx
to/from ounce
Mass Per Length
The base unit for mass per length is kilograms per meters.
x
to/from grams per metersx
to/from grams per milesx
to/from kilograms per kilometersx
to/from grams per kilometers
Pressure
The base unit for pressure is pascal.
x
to/from pound force per square inchx
to/from bar
Temperature
The base unit for temperature is kelvin.
x
to/from celsiusx
to/from fahrenheitx
to/from rakinex
to/from romer
Time
The base unit for time is seconds.
x
to/from nanosecondsx
to/from microsecondsx
to/from millisecondsx
to/from minutesx
to/from hoursx
to/from daysx
to/from weeksx
to/from monthsx
to/from yearsx
to/from decadesx
to/from centuries
Volume
The base unit for volume is liters.
x
to/from us liquid gallonsx
to/from us liquid quartx
to/from us liquid pintx
to/from us legal cupx
to/from us fluid ouncesx
to/from us teaspoonx
to/from us tablespoonx
to/from millimetersx
to/from imperial gallonx
to/from imperial quartx
to/from imperial pintx
to/from imperial cupx
to/from imperial fluid ouncesx
to/from imperial teaspoonx
to/from imperial tablespoonx
to/from cubic metersx
to/from cubic footx
t0/from cubic inch
Volume Per Length
The base unit for volume per length is liters per meters.
x
to/from liters per kilometersx
to/from us gallons per milesx
to/from imperial gallons per milesx
to/from liters per 100 kilometers
Localizations
Fuel economy
This is a localization helper it use different conversion under the hood for convinience.
The base unit is liters per meters
x
liters per 100 kilometersx
miles per us gallonsx
miles per imperial gallons
Length Per Time
The base unit is meters per seconds.
x
kilometers per hoursx
miles per hoursx
knotx
meters per seconds
Length Per Volume
The base unit is meters per liters.
x
meters per litersx
kilometers per litersx
miles per imperial gallonsx
miles per us gallons
Length
The base unit is meters.
x
kilometersx
metersx
milesx
inch
Mass Per Length
The base unit is kilograms per meters.
x
grams per metersx
grams per milesx
kilograms per kilometersx
grams per kilometers
Mass
The base unit is kilograms.
x
microgramsx
milligramsx
gramsx
kilogramsx
tonnesx
imperial tonsx
us tonsx
ouncesx
stonex
pounds
Pressure
The base unit is pascals.
x
pascalsx
barx
pound force per square inch
Temperature
The base unit is kelvin.
x
celsiusx
fahrenheitx
kelvinx
rankinex
romer
Time
The base unit is seconds.
x
microsecondsx
millisecondsx
secondsx
minutesx
hoursx
daysx
weeksx
monthsx
yearsx
decadesx
centuries
Volume Per Length
The base unit is liters per meters
x
imperial gallons per milesx
us gallons per milesx
liters per metersx
liters per kilometersx
liters per 100 kilometers
Volume
The base unit is liters
x
cubic footx
cubic feetx
cubic inchx
us/imperial cupx
us/imperial fluid ouncex
us/imperial quartx
us/imperial pintx
us/imperial tablespoonx
us/imperial teaspoonx
us/imperial liquid gallonsx
millilitersx
liters
Supported language for localizations
x
en_US
Features and bugs
For new conversion please fill new conversion.
If you find a bug.
Suggest new language.
Or something else here.
Contributing
Please read our contibuting guides.
Support
If you like or use this package please consider sponsoring me here.