Skip to content

Commit 6da228a

Browse files
fix(formatNumber): custom format with ? as literal
1 parent 71860a7 commit 6da228a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/numbers/custom-number-format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import round from '../common/round';
44

55
const CURRENCY_SYMBOL = "$";
66
const PERCENT_SYMBOL = "%";
7-
const PLACEHOLDER = "??";
7+
const PLACEHOLDER = "__??__";
88
const CURRENCY = "currency";
99
const PERCENT = "percent";
1010
const POINT = ".";

test/numbers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@ describe('custom formatting', () => {
435435
expect(formatNumber(10, "# \\%")).toEqual("10 %");
436436
});
437437

438+
it("formats with question mark as literal", () => {
439+
expect(formatNumber(10, "?\\$#")).toEqual("?$10");
440+
expect(formatNumber(10, "\\?\\$#")).toEqual("?$10");
441+
});
442+
438443
it("formats with quote as literal", () => {
439444
expect(formatNumber(10, "# \"%\"")).toEqual("10 %");
440445
});

0 commit comments

Comments
 (0)