Field Config: Add new units (mΩ, kHz, MHz, GHz, ac, ha) (#71357)

Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
Ihor Yeromin
2023-07-14 12:09:36 -07:00
committed by GitHub
co-authored by nmarrs
parent c4be5cd747
commit 8ced4343f3
2 changed files with 7 additions and 0 deletions
@@ -80,6 +80,8 @@ export const getCategories = (): ValueFormatCategory[] => [
{ name: 'Square Meters (m²)', id: 'areaM2', fn: toFixedUnit('m²') },
{ name: 'Square Feet (ft²)', id: 'areaF2', fn: toFixedUnit('ft²') },
{ name: 'Square Miles (mi²)', id: 'areaMI2', fn: toFixedUnit('mi²') },
{ name: 'Acres (ac)', id: 'acres', fn: toFixedUnit('ac') },
{ name: 'Hectares (ha)', id: 'hectares', fn: toFixedUnit('ha') },
],
},
{
@@ -236,6 +238,7 @@ export const getCategories = (): ValueFormatCategory[] => [
{ name: 'Kilovolt (kV)', id: 'kvolt', fn: SIPrefix('V', 1) },
{ name: 'Millivolt (mV)', id: 'mvolt', fn: SIPrefix('V', -1) },
{ name: 'Decibel-milliwatt (dBm)', id: 'dBm', fn: SIPrefix('dBm') },
{ name: 'Milliohm (mΩ)', id: 'mohm', fn: SIPrefix('Ω', -1) },
{ name: 'Ohm (Ω)', id: 'ohm', fn: SIPrefix('Ω') },
{ name: 'Kiloohm (kΩ)', id: 'kohm', fn: SIPrefix('Ω', 1) },
{ name: 'Megaohm (MΩ)', id: 'Mohm', fn: SIPrefix('Ω', 2) },
@@ -341,6 +344,9 @@ export const getCategories = (): ValueFormatCategory[] => [
formats: [
{ name: 'Revolutions per minute (rpm)', id: 'rotrpm', fn: toFixedUnit('rpm') },
{ name: 'Hertz (Hz)', id: 'rothz', fn: SIPrefix('Hz') },
{ name: 'Kilohertz (kHz)', id: 'rotkhz', fn: SIPrefix('kHz', 3) },
{ name: 'Megahertz (MHz)', id: 'rotmhz', fn: SIPrefix('MHz', 4) },
{ name: 'Gigahertz (GHz)', id: 'rotghz', fn: SIPrefix('GHz', 5) },
{ name: 'Radians per second (rad/s)', id: 'rotrads', fn: toFixedUnit('rad/s') },
{ name: 'Degrees per second (°/s)', id: 'rotdegs', fn: toFixedUnit('°/s') },
],
@@ -40,6 +40,7 @@ describe('valueFormats', () => {
${'kbytes'} | ${undefined} | ${10000000} | ${'9.54 GiB'}
${'deckbytes'} | ${undefined} | ${10000000} | ${'10 GB'}
${'megwatt'} | ${3} | ${1000} | ${'1.000 GW'}
${'mohm'} | ${3} | ${1000} | ${'1.000 Ω'}
${'kohm'} | ${3} | ${1000} | ${'1.000 MΩ'}
${'Mohm'} | ${3} | ${1000} | ${'1.000 GΩ'}
${'farad'} | ${3} | ${1000} | ${'1.000 kF'}