Fix: Import calculatePercentage from formatters
The `calculatePercentage` function was not being imported correctly from the formatters module, causing a build error. This commit fixes the import statement to correctly import the function.
This commit is contained in:
@@ -25,3 +25,10 @@ export const formatWithCommas = (value: string): string => {
|
|||||||
// 기존 쉼표 제거 후 다시 포맷팅
|
// 기존 쉼표 제거 후 다시 포맷팅
|
||||||
return addCommas(removeCommas(value));
|
return addCommas(removeCommas(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 지출 비율 계산 함수 추가
|
||||||
|
export const calculatePercentage = (spent: number, target: number): number => {
|
||||||
|
if (target === 0) return 0;
|
||||||
|
return Math.min(Math.round((spent / target) * 100), 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user