Skip to content

Fixes issue #101: temporarily removing Intl.NumberFormat.prototype.formatToParts()#102

Merged
caridy merged 1 commit intomasterfrom
issue-101
Aug 26, 2016
Merged

Fixes issue #101: temporarily removing Intl.NumberFormat.prototype.formatToParts()#102
caridy merged 1 commit intomasterfrom
issue-101

Conversation

@caridy
Copy link
Contributor

@caridy caridy commented Aug 24, 2016

Based on my last conversation with Allen, we can preserve all the internal changes to accommodate formatToParts without having to expose the new API. Let's continue with the editorial changes until we can get this restock again.

@littledan
Copy link
Member

LGTM, to answer @zbraniecki I'm fine with keeping this current spec text organization as it does not seem to ask for implementations to make normative changes vs ECMA 402 v2 AFAIK (unless the refactoring makes the spec text not fit with certain locales, which I don't know how to evaluate personally). cc @jshin

@caridy
Copy link
Contributor Author

caridy commented Aug 24, 2016

@littledan it will not require normative changes, that's the whole point.

@zbraniecki
Copy link
Member

LGTM

@caridy caridy merged commit 661ce97 into master Aug 26, 2016
@caridy caridy deleted the issue-101 branch August 26, 2016 13:34
stasm added a commit to stasm/ecma402 that referenced this pull request Aug 8, 2017
`Intl.NumberFormat.formatToParts` was first propsed in tc39#30. The spec for
it was created in tc39#79 and merged in tc39#100. Due to browser implemantations
not being ready at the time, it was moved back to Stage 3 in tc39#101.  The
internal refactorings were kept in master and the user-facing method
`formatToParts` was removed from the spec in tc39#102.

As of August 1st, 2017, `Intl.NumberFormat.prototype.formatToParts` has
shipped in two engines (behind a flag): SpiderMonkey and V8.  This PR
brings `Intl.NumberFormat.formatToParts` back as Stage 4 proposal.

    > const usd = Intl.NumberFormat('en', { style: 'currency', currency: 'USD' });
    > usd.format(123456.789)
    '$123,456.79'
    > usd.formatToParts(123456.789)
    [ { type: 'currency', value: '$' },
      { type: 'integer', value: '123' },
      { type: 'group', value: ',' },
      { type: 'integer', value: '456' },
      { type: 'decimal', value: '.' },
      { type: 'fraction', value: '79' } ]

    > const pc = Intl.NumberFormat('en', { style: 'percent', minimumFractionDigits: 2 })
    > pc.format(-0.123456)
    '-12.35%'
    > pc.formatToParts(-0.123456)
    [ { type: 'minusSign', value: '-' },
      { type: 'integer', value: '12' },
      { type: 'decimal', value: '.' },
      { type: 'fraction', value: '35' },
      { type: 'literal', value: '%' } ]
stasm added a commit to stasm/ecma402 that referenced this pull request Aug 8, 2017
`Intl.NumberFormat.formatToParts` was first propsed in tc39#30. The spec for
it was created in tc39#79 and merged in tc39#100 (with follow-ups). Due to
browser implementations not being ready at the time, it was moved back
to Stage 3 in tc39#101.  The internal refactoring were kept in master and
the user-facing method `formatToParts` was removed from the spec in tc39#102.

As of August 1st, 2017, `Intl.NumberFormat.prototype.formatToParts` has
shipped in two engines (behind a flag): SpiderMonkey and V8.  This PR
brings `Intl.NumberFormat.formatToParts` back as Stage 4 proposal.

    > const usd = Intl.NumberFormat('en', { style: 'currency', currency: 'USD' });
    > usd.format(123456.789)
    '$123,456.79'
    > usd.formatToParts(123456.789)
    [ { type: 'currency', value: '$' },
      { type: 'integer', value: '123' },
      { type: 'group', value: ',' },
      { type: 'integer', value: '456' },
      { type: 'decimal', value: '.' },
      { type: 'fraction', value: '79' } ]

    > const pc = Intl.NumberFormat('en', { style: 'percent', minimumFractionDigits: 2 })
    > pc.format(-0.123456)
    '-12.35%'
    > pc.formatToParts(-0.123456)
    [ { type: 'minusSign', value: '-' },
      { type: 'integer', value: '12' },
      { type: 'decimal', value: '.' },
      { type: 'fraction', value: '35' },
      { type: 'literal', value: '%' } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants