|
|
|
@ -57,13 +57,19 @@ defmodule BlockScoutWeb.WeiHelpers do |
|
|
|
|
converted_value = |
|
|
|
|
wei |
|
|
|
|
|> Wei.to(unit) |
|
|
|
|
|> Cldr.Number.to_string!(format: "#,##0.##################") |
|
|
|
|
|
|
|
|
|
formatted_value = |
|
|
|
|
if converted_value > 1_000_000_000_000 do |
|
|
|
|
Cldr.Number.to_string!(converted_value, format: "0.###E+0") |
|
|
|
|
else |
|
|
|
|
Cldr.Number.to_string!(converted_value, format: "#,##0.##################") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if Keyword.get(options, :include_unit_label, true) do |
|
|
|
|
display_unit = display_unit(unit) |
|
|
|
|
"#{converted_value} #{display_unit}" |
|
|
|
|
"#{formatted_value} #{display_unit}" |
|
|
|
|
else |
|
|
|
|
converted_value |
|
|
|
|
formatted_value |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|