Format isk

This commit is contained in:
2023-07-26 17:25:56 +02:00
parent afa4020b31
commit c75f3b6321
2 changed files with 7 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
export const iskFormater = new Intl.NumberFormat("is-IS", {
style: "currency",
currency: "ISK",
const iskFormater = new Intl.NumberFormat("is-IS", {
minimumFractionDigits: 2,
});
export const formatIsk = (value: number | bigint) => iskFormater.format(value) + " ISK";
export const percentFormater = new Intl.NumberFormat("en-US", {
style: "percent",
minimumFractionDigits: 0

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { iskFormater, percentFormater } from '@/formaters';
import { formatIsk, percentFormater } from '@/formaters';
import { useStorage } from '@vueuse/core';
import { computed } from 'vue';
import BuySellSlider from './BuySellSlider.vue';
@@ -49,8 +49,8 @@ const copyToClipboard = (s: string) => navigator.clipboard.writeText(s);
<tbody>
<tr v-for="r in computedResult" :key="r.typeID" class="cursor-pointer" :class="{'bg-emerald-500': (useSellOrder ? r.sell_ratio : r.buy_ratio) >= threshold / 100 }" @click="copyToClipboard(r.name)">
<td>{{ r.name }}</td>
<td class="text-right">{{ iskFormater.format(useSellOrder ? r.sell : r.buy) }}</td>
<td class="text-right">{{ iskFormater.format(useSellOrder ? r.sell_reprocess : r.buy_reprocess) }}</td>
<td class="text-right">{{ formatIsk(useSellOrder ? r.sell : r.buy) }}</td>
<td class="text-right">{{ formatIsk(useSellOrder ? r.sell_reprocess : r.buy_reprocess) }}</td>
<td class="text-right">{{ percentFormater.format(useSellOrder ? r.sell_ratio : r.buy_ratio) }}</td>
</tr>
</tbody>