Strings are converted whole rather than parsed from the front. The
difference matters: Number.parseFloat reads an ISO timestamp as the year,
so a date reaching a numeric field would be announced as 2024 — a
plausible-looking number that was never in the chart. Refusing it lets the
caller fall back or drop the point instead.
Parameters
value: unknown
The value to coerce.
Returns number|null
The number, or null when the value is not entirely one.
Coerces a value to a finite number, or
null.Strings are converted whole rather than parsed from the front. The difference matters:
Number.parseFloatreads an ISO timestamp as the year, so a date reaching a numeric field would be announced as2024— a plausible-looking number that was never in the chart. Refusing it lets the caller fall back or drop the point instead.