Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: The time zone is not displayed on the personal profile page. (#15759)

balibabuc935f305e251
diff --git a/web/src/pages/user-setting/profile/hooks/use-profile.ts b/web/src/pages/user-setting/profile/hooks/use-profile.ts
index ffcd6ae134..a349da5cc1 100644
--- a/web/src/pages/user-setting/profile/hooks/use-profile.ts
+++ b/web/src/pages/user-setting/profile/hooks/use-profile.ts
@@ -4,6 +4,7 @@ import {
useFetchUserInfo,
useSaveSetting,
} from '@/hooks/use-user-setting-request';
+import { TimezoneList } from '@/pages/user-setting/constants';
import { rsaPsw } from '@/utils';
import { useCallback, useEffect, useState } from 'react';
@@ -31,6 +32,14 @@ export const modalTitle = {
[EditType.editPassword]: 'Edit Password',
} as const;
+const normalizeTimezone = (tz: string | undefined): string => {
+ if (!tz) return '';
+ // Support both backend format "UTC+8\tAsia/Shanghai" and frontend format "GMT+08:00 Asia/Shanghai"
+ const parts = tz.split(/\t|\s+/);
+ const ianaName = parts.length > 1 ? parts[parts.length - 1] : tz;
+ return TimezoneList.find((item) => item.id === ianaName)?.name ?? '';
+};
+
export const useProfile = () => {
const { data: userInfo } = useFetchUserInfo();
const [profile, setProfile] = useState<ProfileData>({
@@ -51,13 +60,9 @@ export const useProfile = () => {
} = useSaveSetting();
useEffect(() => {
- // form.setValue('currPasswd', ''); // current password
const profile = {
userName: userInfo.nickname,
- timeZone:
- userInfo.timezone === ' UTC+8\tAsia/Shanghai'
- ? DEFAULT_TIMEZONE.name
- : userInfo.timezone,
+ timeZone: normalizeTimezone(userInfo.timezone) || DEFAULT_TIMEZONE?.name,
avatar: userInfo.avatar || '',
email: userInfo.email,
currPasswd: userInfo.password,
@@ -93,7 +98,6 @@ export const useProfile = () => {
payload.password = rsaPsw(newProfile.currPasswd!) as string;
payload.new_password = rsaPsw(newProfile.newPasswd!) as string;
}
- console.log('payload', payload);
if (editType === EditType.editName && payload.nickname) {
saveSetting({ nickname: payload.nickname });
setProfile(newProfile);
@@ -109,7 +113,6 @@ export const useProfile = () => {
});
setProfile(newProfile);
}
- // saveSetting(payload);
};
const handleEditClick = useCallback(
@@ -127,12 +130,9 @@ export const useProfile = () => {
}, []);
const handleSave = (data: ProfileData) => {
- console.log('handleSave', data);
const newProfile = { ...profile, ...data };
onSubmit(newProfile);
- // setIsEditing(false);
- // setEditForm({});
};
const handleAvatarUpload = (avatar: string) => {
diff --git a/web/src/pages/user-setting/profile/index.tsx b/web/src/pages/user-setting/profile/index.tsx
index 9f330fab33..0356454311 100644
--- a/web/src/pages/user-setting/profile/index.tsx
+++ b/web/src/pages/user-setting/profile/index.tsx
@@ -216,7 +216,7 @@ const ProfilePage: FC = () => {
</label>
<div className="flex-1 flex items-center gap-4">
<div className="text-sm text-text-primary border border-border-button flex-1 rounded-md py-1.5 px-2">
- {profile.currPasswd ? '********' : ''}
+ <span className="inline-block translate-y-0.5">********</span>
</div>
<Button
variant="outline"