Skip to main content
Sign in
Snippets Groups Projects
Commit 6572367c authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Display percent in 'Votre réforme column'.

parent 72b1c60e
No related branches found
No related tags found
No related merge requests found
Pipeline #5913 passed
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
import type { Writable } from "svelte/store" import type { Writable } from "svelte/store"
import type { DisplayMode } from "$lib/displays" import type { DisplayMode } from "$lib/displays"
import { getParameter, rootParameter } from "$lib/parameters" import {
asValueParameter,
getParameter,
rootParameter,
} from "$lib/parameters"
import type { ParametricReform } from "$lib/reforms" import type { ParametricReform } from "$lib/reforms"
import { import {
ParameterReformChangeType, ParameterReformChangeType,
...@@ -117,7 +121,10 @@ ...@@ -117,7 +121,10 @@
<span class="bg-le-jaune text-right font-bold">barème modifié</span> <span class="bg-le-jaune text-right font-bold">barème modifié</span>
{:else} {:else}
<span class="bg-le-jaune text-right font-bold" <span class="bg-le-jaune text-right font-bold"
>{formatValue(parameterReform.value)}</span >{formatValue(
parameterReform.value,
asValueParameter(parameter).unit,
)}</span
> >
{/if} {/if}
</li> </li>
... ...
......
...@@ -11,7 +11,13 @@ export function valueFormatter( ...@@ -11,7 +11,13 @@ export function valueFormatter(
: typeof baseValue === "boolean" : typeof baseValue === "boolean"
? (value: boolean) => (value ? "vrai" : "faux") ? (value: boolean) => (value ? "vrai" : "faux")
: typeof baseValue === "number" : typeof baseValue === "number"
? unit != null && unit.startsWith("currency-") ? unit === "/1" // Unit.Rate
? new Intl.NumberFormat("fr-FR", {
maximumFractionDigits: 2,
minimumFractionDigits: 2,
style: "percent",
}).format
: unit != null && unit.startsWith("currency-")
? new Intl.NumberFormat("fr-FR", { ? new Intl.NumberFormat("fr-FR", {
currency: unit.replace(/^currency-/, ""), currency: unit.replace(/^currency-/, ""),
maximumFractionDigits: 0, maximumFractionDigits: 0,
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment