-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[WEB-3112] fix: Remove default timezone and use user-specific timezone in timezone select #6381
Conversation
…ls and handle the value in timezone select
WalkthroughThe pull request introduces two modifications related to timezone handling in the web application. In the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/core/components/global/timezone-select.tsx (1)
40-40
: LGTM! Good defensive programming practice.The additional null check for
value
prevents potential runtime errors when the value is undefined. This change improves the robustness of the timezone selection component.Consider using type narrowing for better type safety:
-label={value && selectedValue ? selectedValue(value) : label} +label={typeof value === 'string' && selectedValue ? selectedValue(value) : label}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
web/core/components/global/timezone-select.tsx
(1 hunks)web/core/components/profile/form.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (1)
web/core/components/profile/form.tsx (1)
Line range hint
108-114
: LGTM! Proper handling of timezone updates.The timezone update is correctly handled in the user payload and properly saved through the updateCurrentUser function.
Let's verify that the timezone is being used consistently across the application:
#!/bin/bash # Search for timezone usage patterns echo "Searching for timezone references..." rg "user_timezone|timeZone|timezone" -t tsx -t ts # Search for any hardcoded timezone values echo "Checking for hardcoded timezone values..." rg "Asia/Kolkata" -t tsx -t ts
@@ -62,7 +62,7 @@ export const ProfileForm = observer((props: TProfileFormProps) => { | |||
email: user.email || "", | |||
role: profile.role || "Product / Project Manager", | |||
language: profile.language || "en", | |||
user_timezone: "Asia/Kolkata", | |||
user_timezone: user.user_timezone || "Asia/Kolkata", |
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.
🛠️ Refactor suggestion
Consider removing the hardcoded timezone fallback.
While using user.user_timezone
is a good improvement, having "Asia/Kolkata" as a fallback still introduces a default timezone. Consider using the browser's timezone as a fallback instead.
-user_timezone: user.user_timezone || "Asia/Kolkata",
+user_timezone: user.user_timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
user_timezone: user.user_timezone || "Asia/Kolkata", | |
user_timezone: user.user_timezone || Intl.DateTimeFormat().resolvedOptions().timeZone, |
Description
Type of Change
References
[WEB-3112]
Summary by CodeRabbit
TimezoneSelect
component to prevent potential undefined behaviorProfileForm
to use user's existing timezone as default, with fallback to "Asia/Kolkata"