fixes
This commit is contained in:
@@ -3,17 +3,13 @@ export const getPercentage = (progressAmount: number, totalAmount: number) => {
|
||||
return Math.min(100, Math.max(0, (progressAmount / totalAmount) * 100));
|
||||
};
|
||||
|
||||
export const parseSummary = (
|
||||
summary: string | undefined,
|
||||
progressAmount: number,
|
||||
totalAmount: number
|
||||
) => {
|
||||
const displaySummary = summary ?? `Rs ${progressAmount} / Rs ${totalAmount}`;
|
||||
|
||||
const parts = displaySummary.split("/");
|
||||
const prefixAmount = parts[0]?.trim() || "";
|
||||
const suffixString =
|
||||
parts.length > 1 ? `/ ${parts.slice(1).join("/").trim()}` : "";
|
||||
|
||||
return { prefixAmount, suffixString };
|
||||
export const formatCurrency = (val: number) => {
|
||||
const absVal = Math.abs(val);
|
||||
if (absVal >= 100000) {
|
||||
return `₹ ${(val / 100000).toFixed(2)}L`;
|
||||
}
|
||||
if (absVal >= 1000) {
|
||||
return `₹ ${(val / 1000).toFixed(2)}k`;
|
||||
}
|
||||
return `₹ ${val.toFixed(2)}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user