Describe the bug
In formatters.ts, the generateId() method uses Date.now() to generate tokens for placeholders. If for some reason some of the Date methods are overridden, the token may then not match the TOKEN_REGEX format. It would be better to generate a token through a method that is less likely to be overridden.
To Reproduce
Steps to reproduce the behavior:
Create a React app using react-intl and create a message using placeholder / value substitution.
Which package? intl-messageformat
Describe the bug In
formatters.ts
, thegenerateId()
method usesDate.now()
to generate tokens for placeholders. If for some reason some of theDate
methods are overridden, the token may then not match theTOKEN_REGEX
format. It would be better to generate a token through a method that is less likely to be overridden.To Reproduce Steps to reproduce the behavior:
react-intl
and create a message using placeholder / value substitution.date.js
script from https://github.com/datejs/Datejs/blob/master/build/date.js (Yes, this old, but so is our codebase ;) )Expected behavior Placeholders should be replaced by provided values.
CodeSandbox https://codesandbox.io/s/happy-field-sh5y0 Note that if the reference to
date.js
is removed frompublic/index.html
line 26, the correct string appears.