Closed stefnto closed 2 months ago
I can unfortunately not see TestComponent.jsx
in your repo. Based on your description, you're likely missing the await
keyword when calling getFormatter
.
Thank you for your report!
Unfortunately, the reproduction is missing or incomplete, and as such we cannot investigate this issue. Please add a reproduction to the issue, otherwise it will be closed automatically.
Templates:
Creating a good bug report takes time.
To help us resolve the issue quickly, please simplify the reproduction as much as possible by removing any unnecessary code, files, and dependencies that are not directly related to the problem. The easier it is for us to see the issue, the faster we can help you.
Apart from the reproduction, make sure to include the precise steps on how to reproduce the issue, e.g.:
Thank you for your understanding!
Owner
I can unfortunately not see
TestComponent.jsx
in your repo. Based on your description, you're likely missing theawait
keyword when callinggetFormatter
.
That was it, thank you!
Description
In an async server component I make a new Date object, initialize the formatter and use the formatter.dateTime function as covered in the docs, but I get the Error: format.dateTime is not a function
const format = getFormatter(locale); const dateTime = new Date("2024-08-27T10:15:30Z"); console.log(format.dateTime(dateTime, {hour: 'numeric', minute: 'numeric'}));
Verifications
Mandatory reproduction URL
https://github.com/stefnto/next-intl-bug-repro-app-router-format.dateTime-error
Reproduction description
Steps to reproduce:
Expected behaviour
I expected the page to render normally as in the docs