fix(theme): incorrect time format, close #312 (#314)

This commit is contained in:
pengzhanbo 2024-10-26 01:05:13 +08:00 committed by GitHub
parent f714a0c648
commit 97b59bfc76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ const { theme } = useData()
const colors = useTagColors()
const { categories: categoriesLink, tags: tagsLink } = useInternalLink()
const createTime = computed(() => props.post.createTime?.split(' ')[0].replace(/\//g, '-'))
const createTime = computed(() => props.post.createTime?.split(/\s|T/)[0].replace(/\//g, '-'))
const categoryList = computed(() => props.post.categoryList ?? [])
const sticky = computed(() => {

View File

@ -16,7 +16,7 @@ const createTime = computed(() => {
if (!show || (show === 'only-blog' && !isBlogPost.value))
return ''
if (matter.value.createTime)
return matter.value.createTime.split(' ')[0].replace(/\//g, '-')
return matter.value.createTime.split(/\s|T/)[0].replace(/\//g, '-')
return ''
})