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: a reminder for the day sits above Today's times of day

Yashwanth Kamireddieb95eaba55f7
diff --git a/.uiverify/reminders-today-allday.mjs b/.uiverify/reminders-today-allday.mjs
new file mode 100644
index 0000000..51eb7aa
--- /dev/null
+++ b/.uiverify/reminders-today-allday.mjs
@@ -0,0 +1,56 @@
+// Today, as Reminders groups it: a reminder for the day with no time sits above Morning,
+// Afternoon and Tonight with the overdue ones — it has no time of day to be filed under. Taken
+// as its midnight, it went under Morning, and so did every one added in Today.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const BASE = process.env.BASE ?? "http://localhost:4202";
+const b = await engine.launch();
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+const ctx = await b.newContext({ viewport: { width: 1200, height: 800 } });
+await ctx.addInitScript(() => {
+ const d = new Date();
+ // Today, as Apple keeps a day: its midnight in UTC.
+ const day = Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / 1000;
+ window.__smartExtra = [{ guid: "allday1", listGuid: "l1", title: "Renew the parking permit", notes: null, dueAt: day, allDay: true,
+ completedAt: null, priority: 0, flagged: false, parentGuid: null, etag: null }];
+});
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, remindersFixture: true });
+const page = await ctx.newPage();
+page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); failures++; });
+await page.goto(BASE, { waitUntil: "networkidle" });
+await openScreen(page, "Reminders");
+await page.waitForTimeout(600);
+// Each row with the heading it sits under (none for the rows above the first heading).
+const layout = await page.evaluate(() => {
+ const out = [];
+ let heading = null;
+ for (const el of document.querySelectorAll(".rx-section, .rx-row")) {
+ if (el.classList.contains("rx-section")) heading = el.textContent.trim();
+ else out.push([heading, el.querySelector("input, textarea")?.value ?? el.textContent.trim()]);
+ }
+ return out;
+});
+const at = layout.find(([, t]) => t.startsWith("Renew the parking permit"));
+ok(at && at[0] === null, `the day's reminder sits above the times of day ${JSON.stringify(at)} ${JSON.stringify(layout.map(([h]) => h))}`);
+
+// One added in Today is the same: due today, no time.
+const field = page.locator(".rx-add input").first();
+if (await field.count()) {
+ await field.fill("Call the plumber");
+ await field.press("Enter");
+ await page.waitForTimeout(800);
+ const after = await page.evaluate(() => {
+ const out = [];
+ let heading = null;
+ for (const el of document.querySelectorAll(".rx-section, .rx-row")) {
+ if (el.classList.contains("rx-section")) heading = el.textContent.trim();
+ else out.push([heading, el.querySelector("input, textarea")?.value ?? el.textContent.trim()]);
+ }
+ return out;
+ });
+ const added = after.find(([, t]) => t.startsWith("Call the plumber"));
+ ok(added && added[0] === null, `one added in Today sits there too ${JSON.stringify(added)}`);
+} else ok(false, "found the add field");
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index ea2e1d3..09c48ba 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -340,7 +340,8 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
}
case "reminder_list_create": case "reminder_list_rename": case "reminder_list_delete":
return null;
- case "reminders_smart": return !remindersFixture || remindersFixture === "lists" ? [] : reminderItems.filter(r => !r.completedAt);
+ // A suite's own reminders in the smart lists (`window.__smartExtra`).
+ case "reminders_smart": return !remindersFixture || remindersFixture === "lists" ? [] : [...reminderItems, ...(window.__smartExtra ?? [])].filter(r => !r.completedAt);
// Reminders' details (reminders_cmds.rs): tags, a link, early alerts, custom smart lists
// and sections. A test sets __tagMap / __details / __smartLists / __sections to change them.
case "reminder_sections": return (window.__sections ?? []).filter((s) => s.listGuid === args.listGuid);
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index 2e9bef1..9ee0d93 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -1423,8 +1423,9 @@ export function RemindersView() {
for (const row of threaded) {
const due = row.reminder.dueAt;
// Anything overdue, or with no time at all, sits above the buckets — which is where
- // Apple puts it.
- if (due === null || daysApart(now, new Date(due * 1000)) < 0) {
+ // Apple puts it. A day's reminder has no time either: read as its midnight, it went
+ // under Morning, with every one added here.
+ if (due === null || row.reminder.allDay || daysApart(now, new Date(due * 1000)) < 0) {
buckets[0].rows.push(row);
continue;
}