778 B
778 B
Whole-unit amounts and missing values
This USD example follows the operator UI's display convention. Currency is a product choice, not a shared
hardcoded default. Do not use value || '': a known zero must remain visible.
function displayUSD(value) {
if (value === null || value === undefined || value === '') return '';
const amount = Number(value);
if (!Number.isFinite(amount)) return '';
const rounded = Math.round(amount);
return `${rounded < 0 ? '-' : ''}$${Math.abs(rounded).toLocaleString('ru-RU')}`;
}
displayUSD(13320.4) renders $13 320; displayUSD(0) renders $0.
Table cells use text-align: right; font-variant-numeric: tabular-nums.
For compact metrics, use a shared formatter rather than deriving an abbreviated value per page.