-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Bug] - Greeting message uses incorrect timezone (Issue #8580) #8735
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
base: preview
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| import type { Config } from "@react-router/dev/config"; | ||
| import { joinUrlPath } from "@plane/utils"; | ||
|
|
||
| const basePath = joinUrlPath(process.env.VITE_ADMIN_BASE_PATH ?? "", "/") ?? "/"; | ||
| const normalizeBasePath = (value: string): string => { | ||
| const trimmed = value.trim(); | ||
| if (!trimmed || trimmed === "/") return "/"; | ||
| return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`; | ||
| }; | ||
|
Comment on lines
+3
to
+7
|
||
|
|
||
| const basePath = normalizeBasePath(process.env.VITE_ADMIN_BASE_PATH ?? ""); | ||
|
|
||
| export default { | ||
| appDirectory: "app", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,12 @@ import * as dotenv from "@dotenvx/dotenvx"; | |||||||||||||||||||
| import { reactRouter } from "@react-router/dev/vite"; | ||||||||||||||||||||
| import { defineConfig } from "vite"; | ||||||||||||||||||||
| import tsconfigPaths from "vite-tsconfig-paths"; | ||||||||||||||||||||
| import { joinUrlPath } from "@plane/utils"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const normalizeBasePath = (value: string): string => { | ||||||||||||||||||||
| const trimmed = value.trim(); | ||||||||||||||||||||
| if (!trimmed || trimmed === "/") return "/"; | ||||||||||||||||||||
| return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`; | ||||||||||||||||||||
|
Comment on lines
+7
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normalize duplicate separators before setting Vite This version preserves internal Possible fix const normalizeBasePath = (value: string): string => {
const trimmed = value.trim();
if (!trimmed || trimmed === "/") return "/";
- return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`;
+ return `/${trimmed.replace(/\/+/g, "/").replace(/^\/+|\/+$/g, "")}/`;
};📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| }; | ||||||||||||||||||||
|
Comment on lines
+7
to
+11
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| dotenv.config({ path: path.resolve(__dirname, ".env") }); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -15,7 +20,7 @@ const viteEnv = Object.keys(process.env) | |||||||||||||||||||
| return a; | ||||||||||||||||||||
| }, {}); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const basePath = joinUrlPath(process.env.VITE_ADMIN_BASE_PATH ?? "", "/") ?? "/"; | ||||||||||||||||||||
| const basePath = normalizeBasePath(process.env.VITE_ADMIN_BASE_PATH ?? ""); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| export default defineConfig(() => ({ | ||||||||||||||||||||
| base: basePath, | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| import type { Config } from "@react-router/dev/config"; | ||
| import { joinUrlPath } from "@plane/utils"; | ||
|
|
||
| const basePath = joinUrlPath(process.env.VITE_SPACE_BASE_PATH ?? "", "/") ?? "/"; | ||
| const normalizeBasePath = (value: string): string => { | ||
| const trimmed = value.trim(); | ||
| if (!trimmed || trimmed === "/") return "/"; | ||
| return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`; | ||
|
Comment on lines
+3
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Collapse repeated slashes before assigning
Possible fix const normalizeBasePath = (value: string): string => {
const trimmed = value.trim();
if (!trimmed || trimmed === "/") return "/";
- return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`;
+ return `/${trimmed.replace(/\/+/g, "/").replace(/^\/+|\/+$/g, "")}/`;
};🤖 Prompt for AI Agents |
||
| }; | ||
|
Comment on lines
+3
to
+7
|
||
|
|
||
| const basePath = normalizeBasePath(process.env.VITE_SPACE_BASE_PATH ?? ""); | ||
|
|
||
| export default { | ||
| appDirectory: "app", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,12 @@ import * as dotenv from "@dotenvx/dotenvx"; | |
| import { reactRouter } from "@react-router/dev/vite"; | ||
| import { defineConfig } from "vite"; | ||
| import tsconfigPaths from "vite-tsconfig-paths"; | ||
| import { joinUrlPath } from "@plane/utils"; | ||
|
|
||
| const normalizeBasePath = (value: string): string => { | ||
| const trimmed = value.trim(); | ||
| if (!trimmed || trimmed === "/") return "/"; | ||
| return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`; | ||
|
Comment on lines
+7
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the old path normalization for Vite This helper now leaves internal Possible fix const normalizeBasePath = (value: string): string => {
const trimmed = value.trim();
if (!trimmed || trimmed === "/") return "/";
- return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`;
+ return `/${trimmed.replace(/\/+/g, "/").replace(/^\/+|\/+$/g, "")}/`;
};🤖 Prompt for AI Agents |
||
| }; | ||
|
Comment on lines
+7
to
+11
|
||
|
|
||
| dotenv.config({ path: path.resolve(__dirname, ".env") }); | ||
|
|
||
|
|
@@ -15,7 +20,7 @@ const viteEnv = Object.keys(process.env) | |
| return a; | ||
| }, {}); | ||
|
|
||
| const basePath = joinUrlPath(process.env.VITE_SPACE_BASE_PATH ?? "", "/") ?? "/"; | ||
| const basePath = normalizeBasePath(process.env.VITE_SPACE_BASE_PATH ?? ""); | ||
|
|
||
| export default defineConfig(() => ({ | ||
| base: basePath, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ | |
| * See the LICENSE file for details. | ||
| */ | ||
|
|
||
| import type { FC } from "react"; | ||
| // plane types | ||
| import { useTranslation } from "@plane/i18n"; | ||
| import type { IUser } from "@plane/types"; | ||
|
|
@@ -23,23 +22,37 @@ export function UserGreetingsView(props: IUserGreetingsView) { | |
| // store hooks | ||
| const { t } = useTranslation(); | ||
|
|
||
| // Use profile timezone when set to a real zone; treat UTC/Etc/UTC as unset (common | ||
| // backend default) so we show local time. Otherwise use browser/OS timezone. | ||
| const profileZone = user?.user_timezone?.trim(); | ||
| const isUtcDefault = | ||
| !profileZone || profileZone === "UTC" || profileZone === "Etc/UTC" || profileZone.toLowerCase() === "utc"; | ||
| const timeZone = isUtcDefault | ||
| ? typeof Intl !== "undefined" && Intl.DateTimeFormat | ||
| ? Intl.DateTimeFormat().resolvedOptions().timeZone | ||
| : undefined | ||
|
Comment on lines
+25
to
+33
|
||
| : profileZone; | ||
|
Comment on lines
+27
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The fallback only matches the exact Possible fix const profileZone = user?.user_timezone?.trim();
- const isUtcDefault =
- !profileZone || profileZone === "UTC" || profileZone === "Etc/UTC" || profileZone.toLowerCase() === "utc";
+ const isUtcDefault = !profileZone || /^(?:etc\/)?utc$/i.test(profileZone);🤖 Prompt for AI Agents |
||
|
|
||
| const hour = new Intl.DateTimeFormat("en-US", { | ||
| hour12: false, | ||
| hour: "numeric", | ||
| ...(timeZone && { timeZone }), | ||
| }).format(currentTime); | ||
|
|
||
| const date = new Intl.DateTimeFormat("en-US", { | ||
| month: "short", | ||
| day: "numeric", | ||
| ...(timeZone && { timeZone }), | ||
| }).format(currentTime); | ||
|
|
||
| const weekDay = new Intl.DateTimeFormat("en-US", { | ||
| weekday: "long", | ||
| ...(timeZone && { timeZone }), | ||
| }).format(currentTime); | ||
|
|
||
| const timeString = new Intl.DateTimeFormat("en-US", { | ||
| timeZone: user?.user_timezone, | ||
| hour12: false, // Use 24-hour format | ||
| ...(timeZone && { timeZone }), | ||
| hour12: false, | ||
| hour: "2-digit", | ||
| minute: "2-digit", | ||
| }).format(currentTime); | ||
|
|
||
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.
Keep
basenamecanonical here as well.normalizeBasePathnow preserves accidental internal//, so the admin router basename changes for env values that the old path joiner would have normalized. That leaves routing behavior dependent on slash typos inVITE_ADMIN_BASE_PATH.Possible fix
const normalizeBasePath = (value: string): string => { const trimmed = value.trim(); if (!trimmed || trimmed === "/") return "/"; - return `/${trimmed.replace(/^\/+|\/+$/g, "")}/`; + return `/${trimmed.replace(/\/+/g, "/").replace(/^\/+|\/+$/g, "")}/`; };📝 Committable suggestion
🤖 Prompt for AI Agents