diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md index c97f28c..21313b9 100644 --- a/docs/docs/changelog.md +++ b/docs/docs/changelog.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can now provide 'time' to the show field on a query. This will only render the time of the task (unless the end of the task is on a different day than the start). +### 🐛 Bug Fixes + +- Date grouping now correctly groups tasks on the same day together regardless of whether they have times + ## v2.3.0 (2025-12-06) ### ✨ Features diff --git a/plugin/src/data/transformations/grouping.test.ts b/plugin/src/data/transformations/grouping.test.ts index fd00c8b..0a24b1f 100644 --- a/plugin/src/data/transformations/grouping.test.ts +++ b/plugin/src/data/transformations/grouping.test.ts @@ -465,6 +465,30 @@ describe("group by date", () => { }, ], }, + { + description: "should group tasks on same due date but different times together", + input: [ + makeTask("a", { + due: makeDueDate("2024-01-12"), + }), + makeTask("b", { + due: makeDueDate("2024-01-12T09:00:00"), + }), + ], + expected: [ + { + header: "Jan 12 ‧ Friday", + tasks: [ + makeTask("a", { + due: makeDueDate("2024-01-12"), + }), + makeTask("b", { + due: makeDueDate("2024-01-12T09:00:00"), + }), + ], + }, + ], + }, ]; for (const tc of testcases) { diff --git a/plugin/src/data/transformations/grouping.ts b/plugin/src/data/transformations/grouping.ts index 3403f6f..2420177 100644 --- a/plugin/src/data/transformations/grouping.ts +++ b/plugin/src/data/transformations/grouping.ts @@ -154,7 +154,8 @@ function groupByDate(tasks: Task[]): GroupedTasks[] { return "Overdue"; } - return task.due.date; + // Discard any time component for grouping purposes + return task.due.date.split("T")[0]; }); const groups = Array.from(dates.entries()); groups.sort((a, b) => {