Skip to content

Commit

Permalink
feat: Add autocomplete support for timeZone (#359 by @A7med3bdulBaset)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedBaset authored Jun 29, 2023
1 parent 6f2f0b9 commit 630dfc2
Show file tree
Hide file tree
Showing 6 changed files with 437 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/use-intl/src/core/DateTimeFormatOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// https://github.com/microsoft/TypeScript/issues/35865

import TimeZone from './TimeZone';

/**
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
*/
Expand Down Expand Up @@ -71,7 +73,7 @@ type DateTimeFormatOptions = Intl.DateTimeFormatOptions & {
/**
* One of the [database names from the TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
*/
timeZone?: string;
timeZone?: TimeZone;

localeMatcher?: 'best fit' | 'lookup';

Expand Down
3 changes: 2 additions & 1 deletion packages/use-intl/src/core/IntlConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Formats from './Formats';
import IntlError from './IntlError';
import TimeZone from './TimeZone';
import {AbstractIntlMessages, RichTranslationValues} from '.';

/**
Expand All @@ -13,7 +14,7 @@ type IntlConfig<Messages = AbstractIntlMessages> = {
* formatting across components. */
formats?: Partial<Formats>;
/** A time zone as defined in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) which will be applied when formatting dates and times. If this is absent, the user time zone will be used. You can override this by supplying an explicit time zone to `formatDateTime`. */
timeZone?: string;
timeZone?: TimeZone;
/** This callback will be invoked when an error is encountered during
* resolving a message or formatting it. This defaults to `console.error` to
* keep your app running. You can customize the handling by taking
Expand Down
Loading

3 comments on commit 630dfc2

@vercel
Copy link

@vercel vercel bot commented on 630dfc2 Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-docs – ./docs

next-intl-docs-git-main-next-intl.vercel.app
next-intl-docs.vercel.app
next-intl-docs-next-intl.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 630dfc2 Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-example-next-13 – ./examples/example-next-13

next-intl-example-next-13.vercel.app
next-intl-example-next-13-next-intl.vercel.app
next-intl-example-next-13-git-main-next-intl.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 630dfc2 Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

example-next-13-next-auth – ./examples/example-next-13-next-auth

example-next-13-next-auth-git-main-next-intl.vercel.app
example-next-13-next-auth-next-intl.vercel.app
example-next-13-next-auth.vercel.app

Please sign in to comment.