This commit is contained in:
nepiedg
2026-02-23 22:24:29 +08:00
parent ff68f7f3ae
commit 031eef9643
7 changed files with 494 additions and 148 deletions
+10 -5
View File
@@ -13,9 +13,6 @@
{{ tab.label }}
</view>
</view>
<view class="filter-btn">
<text class="filter-icon">📅</text>
</view>
</view>
<!-- 记录列表 -->
@@ -165,6 +162,14 @@ const groupedLogs = computed(() => {
}, {})
})
// 本地日期 YYYY-MM-DD(避免 toISOString 用 UTC 导致日期差一天)
function localDateStr(d) {
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
}
// 格式化分组标题
function formatGroupTitle(dateStr) {
if (!dateStr) return ''
@@ -174,8 +179,8 @@ function formatGroupTitle(dateStr) {
const yesterday = new Date(today)
yesterday.setDate(yesterday.getDate() - 1)
const todayStr = today.toISOString().split('T')[0]
const yesterdayStr = yesterday.toISOString().split('T')[0]
const todayStr = localDateStr(today)
const yesterdayStr = localDateStr(yesterday)
if (dateStr === todayStr) {
return '今天'