Feat: frontend support timezone of timestamp (#4070)

This commit is contained in:
KVOJJJin
2024-05-04 16:15:32 +08:00
committed by GitHub
parent f68b6b0e5e
commit c0476c7881
15 changed files with 88 additions and 58 deletions

View File

@@ -1,11 +1,12 @@
import { memo } from 'react'
import dayjs from 'dayjs'
import { useTranslation } from 'react-i18next'
import { useWorkflow } from '../hooks'
import { useStore } from '@/app/components/workflow/store'
import useTimestamp from '@/hooks/use-timestamp'
const EditingTitle = () => {
const { t } = useTranslation()
const { formatTime } = useTimestamp()
const { formatTimeFromNow } = useWorkflow()
const draftUpdatedAt = useStore(state => state.draftUpdatedAt)
const publishedAt = useStore(state => state.publishedAt)
@@ -15,7 +16,7 @@ const EditingTitle = () => {
{
!!draftUpdatedAt && (
<>
{t('workflow.common.autoSaved')} {dayjs(draftUpdatedAt).format('HH:mm:ss')}
{t('workflow.common.autoSaved')} {formatTime(draftUpdatedAt / 1000, 'HH:mm:ss')}
</>
)
}