Skip to content

Commit e2a6ea8

Browse files
committed
fix(#191): possible fix for missing historical data
1 parent 0e5d154 commit e2a6ea8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function normalizeStateValue(
4444
state: number,
4545
unit_of_measurement?: string,
4646
): { state: number; unit_of_measurement?: string } {
47-
const validState = Math.max(0, state);
47+
const validState = Math.max(0, state) || 0; // the 0 check is for NaN
4848
if (!unit_of_measurement || unit_of_measurement == 'monetary') {
4949
return { state: validState, unit_of_measurement };
5050
}

0 commit comments

Comments
 (0)