Skip to content

fix(date-picker):Fix the default time zone is not displayed #3389

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

Merged
merged 1 commit into from
May 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/renderless/src/date-panel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,15 @@ export const getRenderTz =
return
}

state.renderTzdata = value[state.lang]
// 规避因国际化lang中划线以及下划线匹配不到时区数据
const lang = state.lang.replace(/[-_]/g, '').toLowerCase()
Object.keys(value).forEach(key => {
if (key.replace(/[-_]/g, '').toLowerCase() === lang) {

Choose a reason for hiding this comment

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

确保在处理语言匹配时,替换后的语言键不会与现有键冲突。建议在替换语言键之前检查其唯一性,以避免潜在的数据覆盖问题。

value[lang] = value[key]
}
});

state.renderTzdata = value[lang]
if (state.renderTzdata) {
const { isServiceTimezone, to } = state.timezone
const selectedTz = state.selectedTz || {}
Expand Down
Loading