diff --git a/pages/dashboard/index.vue b/pages/dashboard/index.vue
index abd4ef71c..9a3472b39 100644
--- a/pages/dashboard/index.vue
+++ b/pages/dashboard/index.vue
@@ -42,9 +42,9 @@
Total revenue
- {{ $formatMoney(payouts.all_time) }}
+ {{ $formatMoney(payouts.all_time, true) }}
-
{{ $formatMoney(payouts.last_month) }} this month
+
{{ $formatMoney(payouts.last_month, true) }} this month
@@ -55,7 +55,7 @@
Current balance
- {{ $formatMoney(auth.user.payout_data.balance) }}
+ {{ $formatMoney(auth.user.payout_data.balance, true) }}
{
})
nuxtApp.provide('sortedCategories', sortedCategories)
})
-export const formatNumber = (number) => {
+export const formatNumber = (number, abbreviate = true) => {
const x = +number
- if (x >= 1000000) {
+ if (x >= 1000000 && abbreviate) {
return (x / 1000000).toFixed(2).toString() + 'M'
- } else if (x >= 10000) {
- return (x / 1000).toFixed(1).toString() + 'K'
+ } else if (x >= 10000 && abbreviate) {
+ return (x / 1000).toFixed(1).toString() + 'k'
} else {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
}
-export const formatMoney = (number) => {
+export const formatMoney = (number, abbreviate = false) => {
+ number = Math.floor(number * 100) / 100
const x = +number
- if (x >= 1000000) {
+ if (x >= 1000000 && abbreviate) {
return '$' + (x / 1000000).toFixed(2).toString() + 'M'
- } else if (x >= 10000) {
- return '$' + (x / 1000).toFixed(1).toString() + 'K'
+ } else if (x >= 10000 && abbreviate) {
+ return '$' + (x / 1000).toFixed(2).toString() + 'k'
} else {
return (
'$' +