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) { 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..0068c7a 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() + 23 * 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() + 47 * 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')) { @@ -171,10 +175,10 @@ 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) + targetDate.setHours(23, 59, 59, 999) return targetDate.toISOString() } @@ -183,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) @@ -192,7 +196,9 @@ function parseDateHeuristic(dateStr: string): string { return targetDate.toISOString() } - return new Date(today.getTime() + 47 * 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 {