fix(firms): drop the decimal when fire power rounds to 10 MW

A 9.96 MW detection was labeled 10.0 MW because the one-decimal cutoff ran before rounding.
This commit is contained in:
Rudy Celekli committed 2026-10-24 00:23:11 -04:00
1 parent 9d3548c27c
commit 2beef9be39
4 files changed
+40 -3

No files matched your search

+5 -3
View File
@@ -4,6 +4,7 @@ import {
satelliteShortName,
fireDetectionKey,
accentForSeverity,
formatFrpMw,
} from '../../data/firmsLabels.js';
import {
VIEW_PADDING,
@@ -480,14 +481,15 @@ export function createModel({
}
function formatFrp(frp) {
return frp >= 10 ? frp.toFixed(0) : frp.toFixed(1);
return formatFrpMw(frp);
}
/** formatFrp for a card, with the locale's decimal separator ("4,9"). */
function formatFrpLabel(frp) {
const digits = frp >= 10 ? 0 : 1;
return formatNumber(frp, {
const text = formatFrpMw(frp);
const digits = text.includes('.') ? 1 : 0;
return formatNumber(Number(text), {
minimumFractionDigits: digits,
maximumFractionDigits: digits,
useGrouping: false,