tc39 / ecma402

Status, process, and documents for ECMA 402
https://tc39.es/ecma402/
Other
541 stars 107 forks source link

Add `kilowatt-hour` unit to Intl.NumberFormat #739

Open johanrd opened 1 year ago

johanrd commented 1 year ago

Electric vehicles and construction equipment have already started to report energy consumption as kilowatt-hours in their telemetry APIs, not to mention the many applications in the building and power industries. An increasing amount of web applications are going to be developed as tools to help the current electrification of society.

It would be helpful if ecmascript could make developing these web apps a tiny bit easier by providing kilowatt-hour as a supported unit in Intl.NumberFormat.

I understand the concerns about feature creep in suppoerted units (e.g. https://github.com/tc39/ecma402/issues/607), still adding this as a specific issue.

kalebpace commented 2 weeks ago

This is a great suggestion @johanrd, would you be open to collaborating on this?

Across the energy provider, accounting, and consumer industry, a common set of power and energy units – some already defined in cldr – are used for expressing both generation and consumption when dealing with electric wind/solar/hydro/battery and natural gas.

This set is very common among both providers and consumers:

BTUs are used for comparing different kinds of energy against each other:

And oddly, megawatt-hours are missing from cldr, but just as common and important as kilowatt-hours, so a proposed cldr key could be:

Since these units are used globally, there is a strong need to have them formatted according to a user’s locale settings. Adding them to the ECMAScript standard would allow everyone in this field to express these measurements in a consistent way.