未验证 提交 f9e1ca50 编写于 作者: D Devosend 提交者: GitHub

[Fix][UI Next][V1.0.0-Alpha] Fix workflow timing timezone display bug (#9202)

上级 e4d95eb9
...@@ -38,15 +38,12 @@ import { ...@@ -38,15 +38,12 @@ import {
} from '@/utils/column-width-config' } from '@/utils/column-width-config'
import { format } from 'date-fns-tz' import { format } from 'date-fns-tz'
import { ISearchParam } from './types' import { ISearchParam } from './types'
import { useTimezoneStore } from '@/store/timezone/timezone'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
const router: Router = useRouter() const router: Router = useRouter()
const timezoneStore = useTimezoneStore()
const timeZone = timezoneStore.getTimezone
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
...@@ -61,7 +58,11 @@ export function useTable() { ...@@ -61,7 +58,11 @@ export function useTable() {
showRef: ref(false) showRef: ref(false)
}) })
const renderTime = (time: string) => { const renderTime = (time: string, timeZone: string) => {
if (!timeZone) {
return time
}
const utc = format(new Date(time), 'zzz', { const utc = format(new Date(time), 'zzz', {
timeZone timeZone
}).replace('GMT', 'UTC') }).replace('GMT', 'UTC')
...@@ -96,13 +97,13 @@ export function useTable() { ...@@ -96,13 +97,13 @@ export function useTable() {
title: t('project.workflow.start_time'), title: t('project.workflow.start_time'),
key: 'startTime', key: 'startTime',
...COLUMN_WIDTH_CONFIG['time'], ...COLUMN_WIDTH_CONFIG['time'],
render: (row: any) => renderTime(row.startTime) render: (row: any) => renderTime(row.startTime, row.timezoneId)
}, },
{ {
title: t('project.workflow.end_time'), title: t('project.workflow.end_time'),
key: 'endTime', key: 'endTime',
...COLUMN_WIDTH_CONFIG['time'], ...COLUMN_WIDTH_CONFIG['time'],
render: (row: any) => renderTime(row.endTime) render: (row: any) => renderTime(row.endTime, row.timezoneId)
}, },
{ {
title: t('project.workflow.crontab'), title: t('project.workflow.crontab'),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册