Skip to content

Commit

Permalink
Merge pull request #13 from danielhep/add-timezone
Browse files Browse the repository at this point in the history
feat: add support for timeZone parameter
  • Loading branch information
stevensacks authored Jan 20, 2025
2 parents 26a9e1c + c9494fe commit 136c738
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const reactIntl = {
locales,
messages,
formats,
timeZone: 'America/New_York', // optional, specify a time zone
};
```
---
Expand Down
3 changes: 2 additions & 1 deletion src/withReactIntl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ export const withReactIntl = (
const currentLocale = locale || defaultLocale;

if (currentLocale && reactIntl) {
const {formats, messages, defaultRichTextElements} = reactIntl;
const {formats, messages, defaultRichTextElements, timeZone} = reactIntl;
const safeFormats = formats ? formats[currentLocale] : undefined;
if (messages) {
return (
<IntlProvider
timeZone={timeZone}
key={locale}
formats={safeFormats}
messages={messages[currentLocale]}
Expand Down

0 comments on commit 136c738

Please sign in to comment.