Up to now the default behaviour was to leave the fraction part of the original input amount unchanged.
var lc = new jsworld.Locale(POSIX_LC.en_US); var mf = new jsworld.MonetaryFormatter(lc); alert(mf.format(1500.005));
To enforce rounding and display to a certain precision the optional
".n" argument can be used, where
n is the number of desired fraction digits.
Yesterday I received an email from a customer in the US from which it became apparent that the default non-rounding behaviour was not intuitive to developers. After some consideration I decided to patch the library code to round per default, based on the number of fraction digits for the selected currency. The optional “.n” facility remains the same.
So the above
will now instead result in
The patched version is now available as JsWorld 2.4.1.