fix(default): correct subscription payment display

This commit is contained in:
CaIon
2026-05-06 18:38:02 +08:00
parent dc8deb0c24
commit 446a8420f5
3 changed files with 39 additions and 16 deletions
+6 -6
View File
@@ -1,4 +1,3 @@
import { formatLocalCurrencyAmount } from '@/lib/currency'
import { DEFAULT_DISCOUNT_RATE } from '../constants'
// ============================================================================
@@ -36,11 +35,12 @@ export function formatQuotaShort(quota: number): string {
export function formatCurrency(amount: number | string): string {
const numeric =
typeof amount === 'number' ? amount : Number.parseFloat(String(amount))
return formatLocalCurrencyAmount(Number.isFinite(numeric) ? numeric : null, {
digitsLarge: 2,
digitsSmall: 2,
abbreviate: false,
})
if (!Number.isFinite(numeric)) return '-'
return new Intl.NumberFormat(undefined, {
minimumFractionDigits: 0,
maximumFractionDigits: Math.abs(numeric) >= 1 ? 2 : 4,
}).format(numeric)
}
/**