fix: bytesize in subs info

This commit is contained in:
Zephyruso 2023-09-02 10:44:13 +08:00
parent 265c6cba9e
commit 4aa7c24ba4

View File

@ -3,8 +3,10 @@ import dayjs from 'dayjs'
import type { SubscriptionInfo } from '~/types'
const getSubscriptionsInfo = (subscriptionInfo: SubscriptionInfo) => {
const total = byteSize(subscriptionInfo.Total)
const used = byteSize(subscriptionInfo.Download + subscriptionInfo.Upload)
const total = byteSize(subscriptionInfo.Total, { units: 'iec' })
const used = byteSize(subscriptionInfo.Download + subscriptionInfo.Upload, {
units: 'iec',
})
const percentage = (
((subscriptionInfo.Download + subscriptionInfo.Upload) /
subscriptionInfo.Total) *