-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(js): Add timezone providers #91805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(js): Add timezone providers #91805
Conversation
@@ -74,14 +73,13 @@ export function DateTime({ | |||
// UTC time. | |||
timeZone: timeZone ?? utc, | |||
seconds, | |||
...options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a mistake before. We were spreading the entire user.options
object into the getFormat
function.
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #91805 +/- ##
==========================================
- Coverage 80.27% 80.27% -0.01%
==========================================
Files 10348 10348
Lines 586564 586563 -1
Branches 22574 22574
==========================================
- Hits 470880 470879 -1
Misses 114452 114452
Partials 1232 1232 |
8734977
to
174e081
Compare
a352a67
to
14deb5d
Compare
14deb5d
to
6560288
Compare
6560288
to
ec186b8
Compare
ec186b8
to
283e982
Compare
283e982
to
e90978e
Compare
e90978e
to
c4d54f9
Compare
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This implements a new top-level provider that provides the timezone to components like `<DateTime />`. This provider exposes two provider components and one hook. By default the provider uses the browsers timezone. - `useTimezone` - Get the currently set timezone by the user - `TimezoneProvider` - The simplest provider that provides the timezone using the interface ```tsx <TimezoneProvider timezone="America/Los_Angeles"> ... </TimezoneProvider> ``` - `UserTimezoneProvider` - Provides the timezone from the `ConfigStore` user. Reacts to changes to the user.
This implements a new top-level provider that provides the timezone to
components like
<DateTime />
. This provider exposes two provider components and one hook.By default the provider uses the browsers timezone.
useTimezone
- Get the currently set timezone by the userTimezoneProvider
- The simplest provider that provides the timezone using the interfaceUserTimezoneProvider
- Provides the timezone from theConfigStore
user. Reacts tochanges to the user.