Error formatting date using injection api. · Issue #992 · formatjs/formatjs (original) (raw)

Using react-intl@2.3.0 and react-native@0.44.0.

I'm trying to use the formatDate api using the injectIntl method. When I do so I receive the following stack trace.

SyntaxError: Invalid regular expression: /[\s\S]{4}(((((((())))))))[\s\S]{3})/: Unmatched ')'
reactConsoleErrorHandler @ ExceptionsManager.js:71
console.error @ YellowBox.js:62
formatDate @ index.js:557
componentWillReceiveProps @ RatingTextTip.js:61
(anonymous) @ ReactCompositeComponent.js:846
measureLifeCyclePerf @ ReactCompositeComponent.js:63
updateComponent @ ReactCompositeComponent.js:845
receiveComponent @ ReactCompositeComponent.js:744
receiveComponent @ ReactReconciler.js:158
obj.(anonymous function) @ backend.js:1492
_updateRenderedComponentWithNextElement @ ReactCompositeComponent.js:1139
_updateRenderedComponent @ ReactCompositeComponent.js:1110
_performComponentUpdate @ ReactCompositeComponent.js:1032
updateComponent @ ReactCompositeComponent.js:914
receiveComponent @ ReactCompositeComponent.js:744
receiveComponent @ ReactReconciler.js:158
obj.(anonymous function) @ backend.js:1492
_updateRenderedComponentWithNextElement @ ReactCompositeComponent.js:1139
_updateRenderedComponent @ ReactCompositeComponent.js:1110
_performComponentUpdate @ ReactCompositeComponent.js:1032
updateComponent @ ReactCompositeComponent.js:914
performUpdateIfNecessary @ ReactCompositeComponent.js:769
performUpdateIfNecessary @ ReactReconciler.js:210
obj.(anonymous function) @ backend.js:1492
runBatchedUpdates @ ReactUpdates.js:145
perform @ Transaction.js:150
perform @ Transaction.js:150
perform @ ReactUpdates.js:77
flushBatchedUpdates @ ReactUpdates.js:164
close @ ReactUpdates.js:46
closeAll @ Transaction.js:221
perform @ Transaction.js:163
perform @ ReactUpdates.js:77
flushBatchedUpdates @ ReactUpdates.js:164
closeAll @ Transaction.js:221
perform @ Transaction.js:163
batchedUpdates @ ReactDefaultBatchingStrategy.js:61
batchedUpdates @ ReactUpdates.js:92
batchedUpdates @ ReactGenericBatching.js:38
batchedUpdatesWithControlledComponents @ ReactGenericBatching.js:51
_receiveRootNodeIDEvent @ ReactNativeEventEmitter.js:105
receiveTouches @ ReactNativeEventEmitter.js:192
__callFunction @ MessageQueue.js:250
(anonymous) @ MessageQueue.js:101
__guard @ MessageQueue.js:218
callFunctionReturnFlushedQueue @ MessageQueue.js:100
t @ RNDebuggerWorker.js:1

Example:

this.props.intl.formatDate(Date.now(), {
  year: 'numeric',
  month: 'long',
  day: '2-digit'
})

Have tried a variety of different formats, even using the Date.now() example in the documentation. formatRelative works on the same json. Additionally have tried to load the pjson data from the intl library to the polyfill.

Thanks and let me know if there's anything else I can provide.