HF-24: add stringifyCurrency config callback for TEXT#1661
Closed
marcin-kordas-hoc wants to merge 7 commits intohandsontable:developfrom
Closed
HF-24: add stringifyCurrency config callback for TEXT#1661marcin-kordas-hoc wants to merge 7 commits intohandsontable:developfrom
marcin-kordas-hoc wants to merge 7 commits intohandsontable:developfrom
Conversation
- Replace wrong handsontable#1572 with correct handsontable#1145 (TEXT currency formats issue) - Add parser limitation note to trailing-quote adapter rule - Add NBSP note above console.log output example block
80f30f5 to
0246ce0
Compare
3 tasks
Collaborator
Author
|
Superseded by #1665. Same content (same HEAD SHA), but routed from the upstream branch instead of fork. The fork-side PR was hitting a structural CI failure: 3 matrix checks ( Worktree push routing for future PRs is being fixed locally so this won't repeat. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
stringifyCurrencyconfig option mirroring the existingstringifyDateTime/stringifyDurationcallbacks. When set, theTEXTfunction consults the callback before falling through to the built-in number formatter, so users can plug in locale-aware currency formatting (for example viaIntl.NumberFormator a third-party library) without bringing currency data into the HyperFormula core.The default implementation returns
undefinedso existing TEXT behavior is preserved bit-for-bit.Linked
agents/hyperformula/docs/specs/2026-04-21-hf-24-currency-in-text.mdagents/hyperformula/docs/specs/2026-04-24-hf-24-tech-rationale.mdagents/hyperformula/docs/specs/2026-04-27-hf-24-stringify-currency-plan.mdTests
Tests added in the matching
feature/hf-24-stringify-currencybranch ofhandsontable/hyperformula-tests. Coverage:undefinedundefined) → fall-through tonumberFormatstringifyCurrencyIntl.NumberFormatadapter (USD, EUR via LCID, JPY via LCID, PLN via LCID, accounting two-section, fall-through)Notes
#,##0.00 "zł"(trailing quoted symbol). HF's formula parser does not accept embedded quotes inside TEXT format strings, so the docs example and the corresponding test were swapped to use[$zł-415] #,##0.00(LCID-tagged symbol). The adapter still recognizes the trailing-quote pattern for users invoking the callback outside HyperFormula.test/hyperformula-tests/unit/memory-management.spec.ts) are unrelated to this PR — they originate from PR NUMBER type precision is not precise enough #4 of the private repo and should be fixed in a separate ticket.Test plan
handsontable/hyperformulaPRhandsontable/hyperformula-testsPR (matching branch)Intl.NumberFormaton Node 14+Note
Medium Risk
Touches the
TEXTformatting pipeline by inserting a new callback hook; default behavior is preserved, but a misbehaving callback could change output for anyTEXTformatting call.Overview
Adds a new
stringifyCurrencyconfiguration callback (mirroringstringifyDateTime/stringifyDuration) that lets callers interceptTEXT(value, format)and return a currency-formatted string.format()now consultsconfig.stringifyCurrency(value, formatArg)after date/duration formatting and before the built-innumberFormatfallback; the shippeddefaultStringifyCurrencyreturnsundefinedto keep existing output unchanged.Documentation and changelog are updated with a new Currency integration guide section and examples (including an
Intl.NumberFormatadapter).Reviewed by Cursor Bugbot for commit 0246ce0. Bugbot is set up for automated code reviews on this repo. Configure here.
Private tests PR: handsontable/hyperformula-tests#10