Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Reminders Today: each part of the day in time order — 9:30 PM was listed above 8:30 PM

Yashwanth Kamireddiffd08b8e5814
diff --git a/.uiverify/reminders-empty.mjs b/.uiverify/reminders-empty.mjs
index 223c3c8..e9317a4 100644
--- a/.uiverify/reminders-empty.mjs
+++ b/.uiverify/reminders-empty.mjs
@@ -31,7 +31,14 @@ const empty = await p2.evaluate(() => [...document.querySelectorAll(".rx-section
const next = h.nextElementSibling;
return !next || next.querySelectorAll(".rx-row").length === 0;
}).map((h) => h.textContent.trim()));
-const pass2 = empty.length === 0;
+const tonight = await p2.evaluate(() => {
+ const h = [...document.querySelectorAll(".rx-section")].find((x) => x.textContent.trim() === "Tonight");
+ return h ? [...h.nextElementSibling.querySelectorAll(".rx-row")].map((r) => r.querySelector(".rx-meta, .rx-due, .rx-sub")?.textContent ?? r.textContent) : [];
+});
+const times = tonight.map((t) => t.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i)).filter(Boolean).map((m) => ((+m[1] % 12) + (/p/i.test(m[3]) ? 12 : 0)) * 60 + +m[2]);
+const ordered = times.every((t, i) => i === 0 || times[i - 1] <= t);
+console.log(ordered ? `PASS Tonight runs in time order ${JSON.stringify(times)}` : `FAIL Tonight out of order ${JSON.stringify(times)}`);
+const pass2 = empty.length === 0 && ordered;
console.log(pass2 ? "PASS a Today with reminders shows no empty headings" : `FAIL empty headings: ${JSON.stringify(empty)}`);
await b.close();
process.exitCode = pass && pass2 ? 0 : 1;
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index 543b77c..73b8fa4 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -657,6 +657,12 @@ export function RemindersView() {
const hour = new Date(due * 1000).getHours();
buckets[hour < 12 ? 1 : hour < 17 ? 2 : 3].rows.push(row);
}
+ // Each part of the day in time order, as Today reads; the list's own order put 9:30
+ // above 8:30. A subtask keeps its place under its parent.
+ for (const b of buckets.slice(1)) {
+ if (b.rows.some((r) => r.depth > 0)) continue;
+ b.rows.sort((x, y) => (x.reminder.dueAt ?? 0) - (y.reminder.dueAt ?? 0));
+ }
return buckets
.filter((b) => b.rows.length > 0)
// The buckets are all today, so a row under one needs only its time. The loose rows