From 336bd1449338531cce558a8bfe699f377b429793 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:45:37 +0000 Subject: [PATCH 1/5] Initial plan From 7d208362c5f26dac085f3e756dee712446369ea8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:49:05 +0000 Subject: [PATCH 2/5] Fix all bugs: CI YAML indentation, missing crypto import, and server.js import Co-authored-by: recabasic <102372274+recabasic@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- backend/src/core/index.ts | 2 +- backend/src/core/routes/flashcards.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b14477..40901a4 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: context: . file: ./backend/Dockerfile push: false - tags: pagelm-backend:test + tags: pagelm-backend:test cache-from: type=gha cache-to: type=gha,mode=max @@ -87,7 +87,7 @@ jobs: context: ./frontend file: ./frontend/Dockerfile push: false - tags: pagelm-frontend:test + tags: pagelm-frontend:test cache-from: type=gha cache-to: type=gha,mode=max diff --git a/backend/src/core/index.ts b/backend/src/core/index.ts index 6cfbaaa..39f3cb5 100755 --- a/backend/src/core/index.ts +++ b/backend/src/core/index.ts @@ -1,6 +1,6 @@ import cors from 'cors'; import path from 'path' -import server from '../utils/server/server' +import server from '../utils/server/server.js' import { registerRoutes } from './router' import { loggerMiddleware } from './middleware' diff --git a/backend/src/core/routes/flashcards.ts b/backend/src/core/routes/flashcards.ts index d2de9b6..95710ae 100755 --- a/backend/src/core/routes/flashcards.ts +++ b/backend/src/core/routes/flashcards.ts @@ -1,3 +1,4 @@ +import crypto from 'crypto' import db from '../../utils/database/keyv' export function flashcardRoutes(app: any) { From 17850a91dc8aade97c06be74273a02cc18173f40 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:58:12 +0000 Subject: [PATCH 3/5] Fix logic errors in date/time calculations Co-authored-by: recabasic <102372274+recabasic@users.noreply.github.com> --- backend/src/core/routes/planner.ts | 5 ++++- backend/src/services/planner/ai.ts | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/src/core/routes/planner.ts b/backend/src/core/routes/planner.ts index a2d6f5f..3b2c5fe 100644 --- a/backend/src/core/routes/planner.ts +++ b/backend/src/core/routes/planner.ts @@ -320,7 +320,10 @@ setInterval(async () => { if (hh === 8 && mm < 5 && lastDigest !== today) { lastDigest = today - const tomorrow = new Date(today + "T23:59:59Z").toISOString() + const tomorrowDate = new Date(now) + tomorrowDate.setDate(tomorrowDate.getDate() + 1) + tomorrowDate.setHours(23, 59, 59, 999) + const tomorrow = tomorrowDate.toISOString() const tasks = await plannerService.listTasks({ dueBefore: tomorrow }) const dueToday = tasks.filter(t => new Date(t.dueAt).toDateString() === new Date(today).toDateString()) const todaySessions = await plannerService.getTodaySessions() diff --git a/backend/src/services/planner/ai.ts b/backend/src/services/planner/ai.ts index d7ca390..9d46ed8 100644 --- a/backend/src/services/planner/ai.ts +++ b/backend/src/services/planner/ai.ts @@ -138,11 +138,11 @@ function parseDateHeuristic(dateStr: string): string { const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()) if (dateStr.toLowerCase() === 'today') { - return new Date(today.getTime() + 23 * 60 * 60 * 1000).toISOString() + return new Date(today.getTime() + 24 * 60 * 60 * 1000).toISOString() } if (dateStr.toLowerCase() === 'tomorrow') { - return new Date(today.getTime() + 47 * 60 * 60 * 1000).toISOString() + return new Date(today.getTime() + 48 * 60 * 60 * 1000).toISOString() } if (dateStr.toLowerCase().includes('next week')) { @@ -171,7 +171,7 @@ function parseDateHeuristic(dateStr: string): string { if (targetDay !== -1) { const currentDay = now.getDay() let daysToAdd = targetDay - currentDay - if (daysToAdd <= 0) daysToAdd += 7 + if (daysToAdd < 0) daysToAdd += 7 const targetDate = new Date(today.getTime() + daysToAdd * 24 * 60 * 60 * 1000) targetDate.setHours(23, 59, 0, 0) @@ -192,7 +192,7 @@ function parseDateHeuristic(dateStr: string): string { return targetDate.toISOString() } - return new Date(today.getTime() + 47 * 60 * 60 * 1000).toISOString() + return new Date(today.getTime() + 48 * 60 * 60 * 1000).toISOString() } export async function generateSteps(task: Task): Promise { From 6ee76efb13367839ca75a364044fc03eebe3bc5e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:59:11 +0000 Subject: [PATCH 4/5] Improve date/time logic to properly set end-of-day times Co-authored-by: recabasic <102372274+recabasic@users.noreply.github.com> --- backend/src/services/planner/ai.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/services/planner/ai.ts b/backend/src/services/planner/ai.ts index 9d46ed8..6c6d29b 100644 --- a/backend/src/services/planner/ai.ts +++ b/backend/src/services/planner/ai.ts @@ -138,11 +138,15 @@ function parseDateHeuristic(dateStr: string): string { const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()) if (dateStr.toLowerCase() === 'today') { - return new Date(today.getTime() + 24 * 60 * 60 * 1000).toISOString() + const todayEnd = new Date(today) + todayEnd.setHours(23, 59, 59, 999) + return todayEnd.toISOString() } if (dateStr.toLowerCase() === 'tomorrow') { - return new Date(today.getTime() + 48 * 60 * 60 * 1000).toISOString() + const tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000) + tomorrow.setHours(23, 59, 59, 999) + return tomorrow.toISOString() } if (dateStr.toLowerCase().includes('next week')) { @@ -192,7 +196,9 @@ function parseDateHeuristic(dateStr: string): string { return targetDate.toISOString() } - return new Date(today.getTime() + 48 * 60 * 60 * 1000).toISOString() + const tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000) + tomorrow.setHours(23, 59, 59, 999) + return tomorrow.toISOString() } export async function generateSteps(task: Task): Promise { From 2bb4f92eb024a1bdf00b121ac07107cd48764774 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:00:07 +0000 Subject: [PATCH 5/5] Make end-of-day time precision consistent across all date calculations Co-authored-by: recabasic <102372274+recabasic@users.noreply.github.com> --- backend/src/services/planner/ai.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/services/planner/ai.ts b/backend/src/services/planner/ai.ts index 6c6d29b..0068c7a 100644 --- a/backend/src/services/planner/ai.ts +++ b/backend/src/services/planner/ai.ts @@ -178,7 +178,7 @@ function parseDateHeuristic(dateStr: string): string { if (daysToAdd < 0) daysToAdd += 7 const targetDate = new Date(today.getTime() + daysToAdd * 24 * 60 * 60 * 1000) - targetDate.setHours(23, 59, 0, 0) + targetDate.setHours(23, 59, 59, 999) return targetDate.toISOString() } @@ -187,7 +187,7 @@ function parseDateHeuristic(dateStr: string): string { const month = parseInt(dateMatch[1]) - 1 const day = parseInt(dateMatch[2]) const year = now.getFullYear() - const targetDate = new Date(year, month, day, 23, 59, 0, 0) + const targetDate = new Date(year, month, day, 23, 59, 59, 999) if (targetDate.getTime() < now.getTime()) { targetDate.setFullYear(year + 1)