Skip to content

[Support] Parsing PJ #1142

Closed
Closed
@akasolace

Description

@akasolace

First of all, thank you for making this library open-source.

In my energy conversion app, I am using the function Energy.TryParseUnit().

I had already encountered not recognized abbreviations that I could fix using MapUnitToDefaultAbbreviation, for example:

UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation(VolumeUnit.CubicKilometer, "bcm");

But now I have encountered unit PetaJoule "PJ" and the parsing is throwing an error. I have tried something like the following but it does not work
UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation(new Energy(1000, EnergyUnit.Gigajoule), "joule");

Any help would be welcome.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions