Chore/slice workflow (#18351)

This commit is contained in:
zxhlyh
2025-04-18 13:59:12 +08:00
committed by GitHub
parent 523efbfea5
commit efe5db38ee
44 changed files with 1855 additions and 1239 deletions

View File

@@ -0,0 +1,12 @@
import dayjs from 'dayjs'
import { useCallback } from 'react'
import { useI18N } from '@/context/i18n'
export const useFormatTimeFromNow = () => {
const { locale } = useI18N()
const formatTimeFromNow = useCallback((time: number) => {
return dayjs(time).locale(locale === 'zh-Hans' ? 'zh-cn' : locale).fromNow()
}, [locale])
return { formatTimeFromNow }
}