RIFM 1.1 adds a builtin locale-aware number formatter at rifm/number. It formats numeric input without converting it to a JavaScript number, preserving editable states such as 1. and 1.20 as well as the precision of large integers.
Example
import { createNumberFormatter } from "rifm/number";
const euro = createNumberFormatter({
locales: "de-DE",
allowNegative: true,
useGrouping: true,
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});
const rifm = useRifm({
value,
onChange: setValue,
...euro,
});
return <input value={rifm.value} onChange={rifm.onChange} />;Typing -12345,6 produces -12.345,60: the locale controls the decimal and grouping separators, negative values are enabled explicitly, and the fraction is padded and limited to two digits.
Full changelog: v1.0.0...v1.1.0