#3787·leantime

[Bug]: To-Dos Table View shows due date shifted +1 day ahead due to unlocalized raw DateTime parsing in showAll.blade.php

Author: maruf-pfcCreated Sep 14, 2026Updated Sep 14, 2026

What is your set up?

Self Hosted Docker

Version

v3.9.8 (current master branch)

Describe the issue

When setting a task due date (e.g., September 14 or September 20), the Table View (/tickets/showAll) displays the due date shifted +1 day ahead (e.g., September 15 or September 21).

However:

  • The Kanban View (/tickets/showKanban) displays the correct date.
  • The Ticket Details Modal displays the correct date.
  • The Telegram / Messenger Notifications display the correct date.

Only the Table View shows the incorrect shifted date.

Root Cause Analysis:

  1. When a task is saved with a due date, Tickets::prepareTicketDates() converts the user's local end-of-day (23:59:59) into UTC for database storage (dateToFinish). For any timezone behind UTC (or when local end-of-day rolls past UTC midnight), this is stored as the next morning in UTC (e.g., 2026-09-21 06:59:59).
  2. Everywhere else (Kanban, Ticket Modal, Telegram notifications), Leantime converts the UTC timestamp back to the user's timezone using format($dateToFinish)->date() or dtHelper()->parseDbDateTime($dateToFinish)->formatDateForUser().
  3. In app/Domain/Tickets/Templates/showAll.blade.php (lines 318–319), raw PHP new DateTime($row['dateToFinish']) is used without timezone conversion:
    php
    $date = new DateTime($row['dateToFinish']);
    $date = $date->format(__('language.dateformat'));
    Because new DateTime() treats the raw string as-is without user timezone translation, 2026-09-21 06:59:59 is formatted directly as 09/21/2026 instead of converting back to 09/20/2026.

Affected Files:

Suggested Fix:

Replace the manual new DateTime() formatting in showAll.blade.php and subTasks.blade.php with the standard Leantime format() helper (matching showKanban.blade.php and partials/ticketCard.blade.php):

diff
--- a/app/Domain/Tickets/Templates/showAll.blade.php
+++ b/app/Domain/Tickets/Templates/showAll.blade.php
@@ -314,9 +314,7 @@
                             @php
                             if ($row['dateToFinish'] == '0000-00-00 00:00:00' || $row['dateToFinish'] == '1969-12-31 00:00:00') {
                                 $date = __('text.anytime');
                             } else {
-                                $date = new DateTime($row['dateToFinish']);
-                                $date = $date->format(__('language.dateformat'));
+                                $date = format($row['dateToFinish'])->date();
                             }
                             @endphp

Reproduction steps

  1. Open any project and go to To-Dos (/tickets/showKanban or /tickets/showAll).
  2. Create or edit a task and set its due date to September 20, 2026.
  3. Check the Telegram notification or open the task details modal: it correctly says 09/20/2026.
  4. Switch to the Table View tab (/tickets/showAll): the Due Date column displays 09/21/2026 (+1 day discrepancy).

Error Logs (LEANTIMEFOLDER/storage/logs)

Database stored value:

sql
SELECT id, headline, dateToFinish FROM zp_tickets WHERE id = 208;
-- Output: 208 | NTRCA 100 MCQ - 7th | 2026-09-21 06:59:59
Image