refactor: improve date handling and timezone consistency
- Add timezone support to database module (+08:00) - Extract date formatting utilities to shared modules - Standardize timezone handling across frontend and backend - Improve date formatting consistency in UI components - Refactor crawler page.goto options for better readability
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<el-table-column prop="source" label="来源" width="200" />
|
||||
<el-table-column prop="publishDate" label="发布日期" width="180">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.publishDate) }}
|
||||
{{ formatSimpleDate(scope.row.publishDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -51,6 +51,7 @@ import { ref, onMounted } from 'vue'
|
||||
import api from '../utils/api'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Loading, InfoFilled, Paperclip } from '@element-plus/icons-vue'
|
||||
import { formatSimpleDate } from '../utils/date.util'
|
||||
|
||||
const emit = defineEmits<{
|
||||
pinChanged: [title: string]
|
||||
@@ -88,16 +89,6 @@ const togglePin = async (item: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化日期,只显示年月日
|
||||
const formatDate = (dateStr: string) => {
|
||||
if (!dateStr) return ''
|
||||
const date = new Date(dateStr)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
// 初始化时加载置顶项目
|
||||
onMounted(() => {
|
||||
loadPinnedBids()
|
||||
|
||||
Reference in New Issue
Block a user