Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntlProvider formats & defaultFormats seem broken in latest release (3.3.2). #1500

Closed
zjr opened this issue Oct 13, 2019 · 6 comments
Closed

Comments

@zjr
Copy link

zjr commented Oct 13, 2019

Expected behavior

Using formats & defaultFormats should allow printing formatted messages with custom formats.

<IntlProvider . . . defaultFormats={{ date: { 'short-weekday': { weekday: 'short' } } }} . . ./>

Should allow message with "The day is {monday, date, short-weekday}." to render as "The day is Mon."

Current behavior

Instead formats and defaultFormats do nothing and date is rendered with default format (e.g. "The day is 10/14/2019."

I have verified that this all works if I downgrade version to 3.0.0, have not yet tested other versions.

Step to reproduce for BUG REPORT

Use IntlProvider wherever, define a defaultFormats, try to use that in a FormattedMessage within/using the provider. Doesn't matter if injected or through hook or just nested.

Your Environment

Executable Version
npm ls react-intl 3.3.2
npm ls react 16.9.0
npm --version yarn 1.19.1
node --version 12.11.1
OS Version
macOS Catalina 10.15
Browser Version
Chrome 77.0.3865.90
@zjr
Copy link
Author

zjr commented Oct 13, 2019

After further testing it seems this issue was in fact introduced in the 3.3.2 release, 3.3.1 works as expected.

@longlho
Copy link
Member

longlho commented Oct 13, 2019 via email

@zjr
Copy link
Author

zjr commented Oct 13, 2019

No and I'm not generally aware of a handy way to sandbox react-intl. I can tell you that after installing every version of the package since 3.0.0, 3.3.1 3.3.2 is the only version with an issue. If I have some more time later I will try to figure out how to get this package into a sandbox.

Edit: corrected version

@longlho
Copy link
Member

longlho commented Oct 14, 2019 via email

@zjr
Copy link
Author

zjr commented Oct 14, 2019

Here you go…

this is with v3.3.2, broken: https://codesandbox.io/s/focused-leakey-46yr4
here is with v3.3.1, works: https://codesandbox.io/s/blissful-zhukovsky-9oq4w

@longlho
Copy link
Member

longlho commented Oct 16, 2019 via email

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

No branches or pull requests

2 participants