Internal
Public Access
Fix overdue detection ignoring due_time, harden SW precache installs
Task.is_overdue only compared due_date to today, so a task due at 9am stayed "not overdue" until midnight regardless of due_time (Gitea #7). Now factors in due_time when the due date is today, mirrored in the offline app's isTaskOverdue(). Also hardened the service worker's install step: cache.addAll() lets the browser's HTTP cache satisfy each precache fetch, and since static assets here send no Cache-Control/ETag (just Last-Modified), a CACHE_NAME bump wasn't reliably guaranteed to pick up fresh files. Forcing {cache: 'reload'} on each precache fetch fixes that. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c454423d4d
commit
d67a7e4d8f
@@ -117,7 +117,14 @@ function escapeHtml(str) {
|
||||
function isTaskOverdue(task) {
|
||||
// Mirrors Task.is_overdue in tasks/models.py.
|
||||
if (!task.due_date || task.status === 'completed' || task.status === 'cancelled') return false;
|
||||
return task.due_date < todayLocalStr();
|
||||
const today = todayLocalStr();
|
||||
if (task.due_date < today) return true;
|
||||
if (task.due_date === today && task.due_time) {
|
||||
const now = new Date();
|
||||
const nowStr = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
|
||||
return task.due_time < nowStr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function renderTaskItem(task, tagsBySyncId) {
|
||||
|
||||
Reference in New Issue
Block a user