You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: HF-24 correct default behavior claims for currency formats
The previous wording suggested that the built-in number formatter
handles `$#,##0.00` via the default dispatch path. Sandbox audit
showed the built-in numberFormat actually fails on any format that
includes the comma thousands separator:
TEXT(1234.5, "$#,##0.00") -> "$1235,##0.00" (not "$1,234.50")
The intro paragraph now lists only the formats that genuinely work
without a callback (`$0.00`, `$0`, `$#.00`) and explicitly calls out
the broken cases (`$#,##0.00`, LCID-tagged, accounting two-section).
The Default behavior subsection gains a side-by-side comparison table
(without callback / with adapter / Excel) and a recommendation to set
`stringifyCurrency` for any application showing currency to users.
Docs-only change. No source or test impact.
Copy file name to clipboardExpand all lines: docs/guide/date-and-time-handling.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ And now, HyperFormula recognizes these values as valid dates and can operate on
98
98
99
99
## Currency integration
100
100
101
-
By default, the `TEXT` function recognizes a limited set of currency-looking formats such as`"$#,##0.00"`via the built-in number formatter. When you need richer, locale-aware currency output — for example `"[$€-2] #,##0.00"` (EUR with German grouping) or `"[$zł-415] #,##0.00"` (PLN, locale `pl-PL`) — provide a [`stringifyCurrency`](../api/interfaces/configparams.md#stringifycurrency) callback.
101
+
By default, the `TEXT` function renders only the simplest currency-looking formats — `"$0.00"`,`"$0"`, or `"$#.00"`(no thousands separator). Common Excel patterns such as `"$#,##0.00"` (with comma grouping), `"[$€-2] #,##0.00"` (EUR with German grouping), `"[$zł-415] #,##0.00"` (PLN), or accounting two-section formats like `"$#,##0.00;($#,##0.00)"` are **not** rendered correctly by the built-in number formatter; provide a [`stringifyCurrency`](../api/interfaces/configparams.md#stringifycurrency) callback to handle them.
102
102
103
103
HyperFormula itself ships with **no currency data** and **no currency library dependency**. You choose how to format: native `Intl.NumberFormat`, a third-party library, or a hand-rolled lookup table.
104
104
@@ -128,7 +128,17 @@ This callback handles `$`-prefixed formats and falls through (returns `undefined
128
128
129
129
### Default behavior
130
130
131
-
If you don't set `stringifyCurrency`, HyperFormula uses `defaultStringifyCurrency` which returns `undefined` for every input — the built-in dispatch chain (date, duration, and number formatters) handles the format string. For non-currency formats this preserves the existing `TEXT` behavior. For LCID-tagged currency formats (`[$SYMBOL-LCID] ...`), the built-in number formatter produces best-effort output (the LCID tag is treated as literal characters); setting `stringifyCurrency` is the recommended way to get locale-aware output for these formats.
131
+
If you don't set `stringifyCurrency`, HyperFormula uses `defaultStringifyCurrency` which returns `undefined` for every input. For non-currency formats (`mm/dd/yyyy`, `hh:mm`, etc.) the built-in dispatch chain handles the format string and preserves the existing `TEXT` behavior bit-for-bit. For currency-looking formats the built-in number formatter is intentionally limited:
132
+
133
+
| Format |`TEXT(1234.5, ...)` without callback | With docs adapter callback | Excel |
**Recommendation:** for any application that surfaces currency to end users, configure `stringifyCurrency` — either with the `Intl.NumberFormat` adapter below (zero dependencies) or with a library of your choice. Leaving it unset is appropriate only when the formula corpus does not include currency-shaped TEXT formats.
0 commit comments