주가 표시형식 수정
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
import React, { memo, useEffect, useRef, useState } from 'react';
|
||||
import type { ChangeDir, TickerData } from '../../hooks/useMarketTicker';
|
||||
import { coerceFiniteNumber, safePercentFromRate, safeToFixed } from '../../utils/safeFormat';
|
||||
import { coerceFiniteNumber, safePercentFromRate, formatUpbitKrwPrice } from '../../utils/safeFormat';
|
||||
|
||||
function fmtKrw(price: number | null | undefined | unknown): string {
|
||||
const p = coerceFiniteNumber(price);
|
||||
if (p == null) return '-';
|
||||
if (p >= 1_000_000) return p.toLocaleString('ko-KR', { maximumFractionDigits: 0 });
|
||||
if (p >= 1_000) return p.toLocaleString('ko-KR', { maximumFractionDigits: 0 });
|
||||
if (p >= 1) return p.toLocaleString('ko-KR', { maximumFractionDigits: 2 });
|
||||
if (p >= 0.01) return safeToFixed(p, 4, '-');
|
||||
return safeToFixed(p, 8, '-');
|
||||
return formatUpbitKrwPrice(p, '-');
|
||||
}
|
||||
|
||||
function fmtPct(rate: number | null | undefined | unknown): string {
|
||||
|
||||
Reference in New Issue
Block a user