fix some bugs

This commit is contained in:
2026-06-23 22:31:07 +03:30
parent 4e7d6bca00
commit 71764f7e9a
68 changed files with 1941 additions and 1288 deletions
+14
View File
@@ -13,3 +13,17 @@ export function resolveTradeWeightUnit(settingValue?: string | number | null) {
export function weightFieldLabelForUnit(unit?: string | null) {
return isKilogramUnit(unit) ? 'وزن به کیلوگرم' : 'وزن به گرم'
}
export function formatAmountWithUnit(
value: number | null | undefined,
unit?: string | null,
decimals = 3
): string {
if (value == null || Number.isNaN(Number(value))) {
return '-'
}
const resolvedUnit = (unit ?? TRADE_WEIGHT_UNIT_GRAM).trim() || TRADE_WEIGHT_UNIT_GRAM
return `${Number(Number(value).toFixed(decimals))} ${resolvedUnit}`
}