Parcourir la source

chore: Timezone fix for calendar navigation

jamesread il y a 5 mois
Parent
commit
731be741a1
1 fichiers modifiés avec 4 ajouts et 6 suppressions
  1. 4 6
      frontend/resources/vue/views/LogsCalendarView.vue

+ 4 - 6
frontend/resources/vue/views/LogsCalendarView.vue

@@ -129,12 +129,10 @@ function handleEventClick(event) {
 
 
 function handleDayClick(date) {
 function handleDayClick(date) {
   // Navigate to logs list filtered by the selected date
   // Navigate to logs list filtered by the selected date
-  // Format date as YYYY-MM-DD for the query parameter
-  const year = date.getFullYear()
-  const month = String(date.getMonth() + 1).padStart(2, '0')
-  const day = String(date.getDate()).padStart(2, '0')
-  const dateString = `${year}-${month}-${day}`
-  router.push(`/logs?date=${dateString}`)
+  // Format date as YYYY-MM-DD in UTC to match LogsListView filtering
+  // Convert to UTC before formatting to avoid timezone off-by-one errors
+  const dateString = new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().split('T')[0]
+  router.push({ path: '/logs', query: { date: dateString } })
 }
 }
 
 
 function handleMonthChange(month, year) {
 function handleMonthChange(month, year) {