#3787·leantime

[错误]: 待办事项表格视图显示的到期日期由于 showAll.blade.php 中未本地化的原始 DateTime 解析而提前了 1 天

作者: maruf-pfc创建于 2026年9月14日更新于 2026年9月14日

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:

内容来源: Leantime/leantime