Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Quick Event: "6-7am" is six to seven that morning, not the next day
Yashwanth Kamireddi8d1200cff306
diff --git a/.uiverify/calendar-quick.test.mjs b/.uiverify/calendar-quick.test.mjsindex 66e4bf4..295f9cc 100644--- a/.uiverify/calendar-quick.test.mjs+++ b/.uiverify/calendar-quick.test.mjs@@ -80,3 +80,17 @@ test("numbers that are not times stay in the title", () => {assert.equal(q("Room 101 meeting Thursday 3pm").title, "Room 101 meeting");assert.equal(q("Room 101 meeting Thursday 3pm").startsAt, at(2026, 9, 22, 15));});++test("a range whose am or pm comes at its end is read on that side, on the day named", () => {+ // "6-7am" is six to seven in the morning: the bare 6 had been read as 6 PM, the end pushed into+ // the next morning, and the whole event then moved on a day — tomorrow's gym the day after.+ const gym = q("Gym tomorrow 6-7am");+ assert.deepEqual([gym.startsAt, gym.endsAt], [at(2026, 9, 22, 6), at(2026, 9, 22, 7)]);+ const early = q("Swim Fri 5:30-6:30am");+ assert.deepEqual([early.startsAt, early.endsAt], [at(2026, 9, 23, 5, 30), at(2026, 9, 23, 6, 30)]);+ // And as before: the start on the end's side where it can be, crossing noon or midnight+ // where it has to.+ assert.deepEqual([q("Class tomorrow 7-9pm").startsAt, q("Class tomorrow 7-9pm").endsAt], [at(2026, 9, 22, 19), at(2026, 9, 22, 21)]);+ assert.deepEqual([q("Shift tomorrow 9-5pm").startsAt, q("Shift tomorrow 9-5pm").endsAt], [at(2026, 9, 22, 9), at(2026, 9, 22, 17)]);+ assert.deepEqual([q("Party tomorrow 11-1am").startsAt, q("Party tomorrow 11-1am").endsAt], [at(2026, 9, 22, 23), at(2026, 9, 23, 1)]);+});diff --git a/src/screens/calendar/quick.ts b/src/screens/calendar/quick.tsindex 9242a0c..a544d75 100644--- a/src/screens/calendar/quick.ts+++ b/src/screens/calendar/quick.ts@@ -200,7 +200,17 @@ export function parseQuick(text: string, now: Date = new Date(), dmy: boolean =let allDay = false;if (start) {const s: Clock = start;- const h = hours24(s);+ // A bare start with an am or pm only at the end is read on the end's side where that puts+ // it first ("6-7am" is six in the morning, "7-9pm" seven in the evening), else on the other+ // ("11-1pm" from eleven in the morning). Guessed alone, "6-7am" began at 6 PM and the whole+ // event moved on a day.+ const e0: Clock | null = end;+ let h = hours24(s);+ if (e0 && !s.meridiem && e0.meridiem) {+ const eh0 = hours24(e0);+ const side = hours24(s, e0.meridiem);+ h = side * 60 + s.m < eh0 * 60 + e0.m ? side : hours24(s, e0.meridiem === "am" ? "pm" : "am");+ }const from = new Date(base.getFullYear(), base.getMonth(), base.getDate(), h, s.m);// Today, a time already gone is tomorrow's — unless a day was named.if (!dated && from.getTime() < now.getTime() - 60_000) from.setDate(from.getDate() + 1);