mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-12 19:06:36 +08:00
fix(frontend): format created_at and updated_at with local date across admin views (#1146)
* fix: format created_at and updated_at with local date in admin account view * fix(frontend): format created_at with local date in user management and sender access views * fix(frontend): guard utcToLocalDate against null or empty timestamps
This commit is contained in:
@@ -19,7 +19,8 @@ export const getRouterPathWithLang = (path: string, lang: string) => {
|
|||||||
return getPathWithLocale(path, normalizedLang);
|
return getPathWithLocale(path, normalizedLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const utcToLocalDate = (utcDate: string, useUTCDate: boolean) => {
|
export const utcToLocalDate = (utcDate: string | null | undefined, useUTCDate: boolean) => {
|
||||||
|
if (!utcDate) return '';
|
||||||
const utcDateString = `${utcDate} UTC`;
|
const utcDateString = `${utcDate} UTC`;
|
||||||
if (useUTCDate) {
|
if (useUTCDate) {
|
||||||
return utcDateString;
|
return utcDateString;
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import { useScopedI18n } from '@/i18n/app'
|
|||||||
|
|
||||||
import { useGlobalState } from '../../store'
|
import { useGlobalState } from '../../store'
|
||||||
import { api } from '../../api'
|
import { api } from '../../api'
|
||||||
import { hashPassword } from '../../utils'
|
import { hashPassword, utcToLocalDate } from '../../utils'
|
||||||
import { NButton, NMenu } from 'naive-ui';
|
import { NButton, NMenu } from 'naive-ui';
|
||||||
import { MenuFilled } from '@vicons/material'
|
import { MenuFilled } from '@vicons/material'
|
||||||
import AddressCredentialModal from '../../components/AddressCredentialModal.vue'
|
import AddressCredentialModal from '../../components/AddressCredentialModal.vue'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
loading, adminTab, openSettings,
|
loading, adminTab, openSettings,
|
||||||
adminMailTabAddress, adminSendBoxTabAddress
|
adminMailTabAddress, adminSendBoxTabAddress,
|
||||||
|
useUTCDate
|
||||||
} = useGlobalState()
|
} = useGlobalState()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
@@ -274,13 +275,19 @@ const columns = computed(() => [
|
|||||||
title: t('created_at'),
|
title: t('created_at'),
|
||||||
key: "created_at",
|
key: "created_at",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
sortOrder: sortBy.value === 'created_at' ? sortOrder.value : false
|
sortOrder: sortBy.value === 'created_at' ? sortOrder.value : false,
|
||||||
|
render(row) {
|
||||||
|
return utcToLocalDate(row.created_at, useUTCDate.value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('updated_at'),
|
title: t('updated_at'),
|
||||||
key: "updated_at",
|
key: "updated_at",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
sortOrder: sortBy.value === 'updated_at' ? sortOrder.value : false
|
sortOrder: sortBy.value === 'updated_at' ? sortOrder.value : false,
|
||||||
|
render(row) {
|
||||||
|
return utcToLocalDate(row.updated_at, useUTCDate.value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('source_meta'),
|
title: t('source_meta'),
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import { useScopedI18n } from '@/i18n/app'
|
|||||||
|
|
||||||
import { useGlobalState } from '../../store'
|
import { useGlobalState } from '../../store'
|
||||||
import { api } from '../../api'
|
import { api } from '../../api'
|
||||||
|
import { utcToLocalDate } from '../../utils';
|
||||||
|
|
||||||
const { loading } = useGlobalState()
|
const { loading, useUTCDate } = useGlobalState()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
const { t } = useScopedI18n('views.admin.SenderAccess')
|
const { t } = useScopedI18n('views.admin.SenderAccess')
|
||||||
@@ -70,7 +71,10 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('created_at'),
|
title: t('created_at'),
|
||||||
key: "created_at"
|
key: "created_at",
|
||||||
|
render(row) {
|
||||||
|
return utcToLocalDate(row.created_at, useUTCDate.value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('balance'),
|
title: t('balance'),
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import { MenuFilled } from '@vicons/material'
|
|||||||
|
|
||||||
import { useGlobalState } from '../../store'
|
import { useGlobalState } from '../../store'
|
||||||
import { api } from '../../api'
|
import { api } from '../../api'
|
||||||
import { hashPassword } from '../../utils';
|
import { hashPassword, utcToLocalDate } from '../../utils';
|
||||||
|
|
||||||
import UserAddressManagement from './UserAddressManagement.vue'
|
import UserAddressManagement from './UserAddressManagement.vue'
|
||||||
|
|
||||||
const { loading, openSettings } = useGlobalState()
|
const { loading, openSettings, useUTCDate } = useGlobalState()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
const { t } = useScopedI18n('views.admin.UserManagement')
|
const { t } = useScopedI18n('views.admin.UserManagement')
|
||||||
@@ -193,7 +193,10 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('created_at'),
|
title: t('created_at'),
|
||||||
key: "created_at"
|
key: "created_at",
|
||||||
|
render(row) {
|
||||||
|
return utcToLocalDate(row.created_at, useUTCDate.value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('actions'),
|
title: t('actions'),
|
||||||
|
|||||||
Reference in New Issue
Block a user