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.

Calendar: days holding only all-day things — birthdays, holidays, trips — carry their dot in the mini month and Year

Yashwanth Kamireddi77681f46d921
diff --git a/.uiverify/look-calendar.mjs b/.uiverify/look-calendar.mjs
new file mode 100644
index 0000000..57650fc
--- /dev/null
+++ b/.uiverify/look-calendar.mjs
@@ -0,0 +1,16 @@
+// Not a check: Calendar's Week and Day views, to look at. node look-calendar.mjs <dir>
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const out = process.argv[2] ?? ".";
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1400, height: 850 }, colorScheme: "dark" });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true });
+const p = await ctx.newPage();
+await p.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(p, "Calendar");
+for (const [k, n] of [["2", "week"], ["1", "day"], ["4", "year"]]) {
+ await p.keyboard.press(`Control+${k}`);
+ await p.waitForTimeout(400);
+ await p.screenshot({ path: `${out}/cal-${n}.png` });
+}
+await b.close();
diff --git a/.uiverify/occasions.mjs b/.uiverify/occasions.mjs
index 74b2c0b..1e082e2 100644
--- a/.uiverify/occasions.mjs
+++ b/.uiverify/occasions.mjs
@@ -69,5 +69,10 @@ if (rows.length) {
`the day pane reads: ${JSON.stringify(pane.slice(0, 120))}`);
}
+// A day holding only all-day things — a holiday — still shows as busy in the mini month.
+const diwali = new Date(); diwali.setDate(diwali.getDate() + 5);
+const busyDays = await page.evaluate(() => [...document.querySelectorAll(".cx-side .cx-minimonth-day.is-busy")].map((d) => d.getAttribute("aria-label")));
+const label = diwali.toLocaleDateString(undefined, { dateStyle: "full" });
+ok(busyDays.includes(label), `a holiday's day carries a dot in the mini month [${label}]`, `no dot on ${label}: ${JSON.stringify(busyDays)}`);
await b.close();
process.exitCode = failures === 0 ? 0 : 1;
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index ddca77c..a1f4220 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -499,6 +499,17 @@ export function CalendarView() {
},
[shown, due]
);
+ /** Whether a day has anything at all — all-day events too, which Month draws as bars and
+ * `dayItems` therefore leaves out. The dots in the mini month and Year use this; with
+ * `dayItems` a birthday, a holiday or a trip left its days looking empty. */
+ const busyOn = useCallback(
+ (day: Date) => {
+ const start = seconds(day);
+ const end = seconds(addDays(day, 1));
+ return shown.some((e) => e.startsAt < end && e.endsAt > start) || dayItems(day).length > 0;
+ },
+ [shown, dayItems]
+ );
return (
<TickContext.Provider value={tickValue}>
@@ -533,7 +544,7 @@ export function CalendarView() {
<MiniMonth
selected={selected}
today={now}
- busy={(d) => dayItems(d).length > 0}
+ busy={busyOn}
onPick={(d) => setSelected(d)}
/>
</aside>
@@ -681,7 +692,7 @@ export function CalendarView() {
<MiniMonth
selected={selected}
today={now}
- busy={(d) => dayItems(d).length > 0}
+ busy={busyOn}
onPick={(d) => setSelected(d)}
/>
</DayPane>
@@ -693,7 +704,7 @@ export function CalendarView() {
<YearView
year={selected.getFullYear()}
today={now}
- busy={(d) => dayItems(d).length > 0}
+ busy={busyOn}
onPick={(d) => {
setSelected(d);
setView("day");