Skip to content

Commit 5c09a87

Browse files
committed
plugin: make grouping granular at the day level
1 parent d47a735 commit 5c09a87

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

plugin/src/data/transformations/grouping.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,30 @@ describe("group by date", () => {
465465
},
466466
],
467467
},
468+
{
469+
description: "should group tasks on same due date but different times together",
470+
input: [
471+
makeTask("a", {
472+
due: makeDueDate("2024-01-12"),
473+
}),
474+
makeTask("b", {
475+
due: makeDueDate("2024-01-12T09:00:00"),
476+
}),
477+
],
478+
expected: [
479+
{
480+
header: "Jan 12 ‧ Friday",
481+
tasks: [
482+
makeTask("a", {
483+
due: makeDueDate("2024-01-12"),
484+
}),
485+
makeTask("b", {
486+
due: makeDueDate("2024-01-12T09:00:00"),
487+
}),
488+
],
489+
},
490+
],
491+
},
468492
];
469493

470494
for (const tc of testcases) {

plugin/src/data/transformations/grouping.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ function groupByDate(tasks: Task[]): GroupedTasks[] {
154154
return "Overdue";
155155
}
156156

157-
return task.due.date;
157+
// Discard any time component for grouping purposes
158+
return task.due.date.split("T")[0];
158159
});
159160
const groups = Array.from(dates.entries());
160161
groups.sort((a, b) => {

0 commit comments

Comments
 (0)