We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ad7f6d commit 3042460Copy full SHA for 3042460
src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/formatters/Percentage.svelte
@@ -0,0 +1,19 @@
1
+<script lang="ts">
2
+ interface Props {
3
+ percent: null | number;
4
+ }
5
+
6
+ let { percent }: Props = $props();
7
8
+ const formatOptions = {
9
+ maximumFractionDigits: 1,
10
+ minimumFractionDigits: 1,
11
+ style: 'percent'
12
+ };
13
+</script>
14
15
+{#if percent !== null && !isNaN(percent) && isFinite(percent)}
16
+ {Intl.NumberFormat(undefined, formatOptions).format(percent / 100)}
17
+{:else}
18
+ {Intl.NumberFormat(undefined, formatOptions).format(0)}
19
+{/if}
0 commit comments