Skip to content

Commit

Permalink
feat(intl-messageformat): support argstyle integer natively, fix #2989
Browse files Browse the repository at this point in the history
  • Loading branch information
longlho committed Jun 21, 2021
1 parent 42efc60 commit ac94068
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/intl-messageformat/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ export class IntlMessageFormat {
// and Intl.DateTimeFormat instances.
static formats: Formats = {
number: {
integer: {
maximumFractionDigits: 0,
},
currency: {
style: 'currency',
},
Expand Down
8 changes: 8 additions & 0 deletions packages/intl-messageformat/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,14 @@ describe('IntlMessageFormat', function () {
})
})

it('default format like in ICU should work', function () {
expect(
new IntlMessageFormat('{amount, number, integer}', 'en-US').format({
amount: 123456.78,
})
).toBe('123,457')
})

it('number skeleton', function () {
expect(
new IntlMessageFormat(
Expand Down

0 comments on commit ac94068

Please sign in to comment.