fix(frontend): calendar session navigation - enable today click always, show indicator only for dates with sessions, use UTC for consistent date matching

This commit is contained in:
2026-04-07 11:18:07 +08:00
parent 721ddbeef9
commit 7aef898bf5
2 changed files with 26 additions and 21 deletions

View File

@@ -121,12 +121,14 @@ function handleCalendarDateSelect(dateKey: string) {
// Reload conversations to get latest data
loadConversations().then(() => {
// Find conversation that matches the selected date (by updated_at)
const targetDate = new Date(dateKey)
const targetDateStart = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate())
const targetDateEnd = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate() + 1)
// Use UTC to avoid timezone issues
const [year, month, day] = dateKey.split('-').map(Number)
const targetDateStart = new Date(Date.UTC(year, month - 1, day))
const targetDateEnd = new Date(Date.UTC(year, month - 1, day + 1))
// Find conversation that falls on the selected date
const conversation = store.conversations.find((conv) => {
const conversations = store.conversations.value ?? store.conversations
const conversation = conversations.find((conv) => {
const convDate = new Date(conv.updated_at)
return convDate >= targetDateStart && convDate < targetDateEnd
})
@@ -300,8 +302,8 @@ function renderMarkdown(content: string) {
v-for="cell in calendarCells"
:key="cell.key"
class="calendar-day"
:class="{ active: cell.active, busy: cell.busy, muted: cell.value === null, selected: cell.selected, clickable: cell.hasConversation || cell.active }"
@click="(cell.hasConversation || cell.active) && handleCalendarDateSelect(cell.key)"
:class="{ active: cell.active, busy: cell.busy, muted: cell.value === null, selected: cell.selected, clickable: cell.active || cell.hasConversation }"
@click="(cell.active || cell.hasConversation) && handleCalendarDateSelect(cell.key)"
>
{{ cell.value ?? '' }}
<span v-if="cell.hasConversation" class="conv-indicator"></span>