-
Notifications
You must be signed in to change notification settings - Fork 225
Fix logic errors in task scheduling date/time calculations #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
336bd14
7d20836
17850a9
6ee76ef
2bb4f92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
|
Comment on lines
+323
to
+326
|
||
| 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() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
|
Comment on lines
146
to
+149
|
||
| } | ||
|
|
||
| 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) | ||
|
Comment on lines
176
to
+181
|
||
| 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<string[]> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR description lists only planner-related files, but this PR also changes
backend/src/core/routes/flashcards.ts,backend/src/core/index.ts, and.github/workflows/ci.yml. Please either update the PR description to cover these changes or split them into a separate PR to keep scope clear.