feat: unify currency display to toman across the application
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// واحد API/درگاه ریال است؛ نمایش تومان (÷۱۰) و در صورت ورودی ×۱۰.
|
||||
export const RIAL_PER_TOMAN = 10;
|
||||
|
||||
export const rialToToman = (rial) => Math.round((Number(rial) || 0) / RIAL_PER_TOMAN);
|
||||
export const tomanToRial = (toman) => Math.round((Number(toman) || 0) * RIAL_PER_TOMAN);
|
||||
|
||||
// فرمت فارسیِ مبلغ تومان از مقدار ریالِ API.
|
||||
export const formatToman = (rial) => rialToToman(rial).toLocaleString("fa-IR");
|
||||
Reference in New Issue
Block a user