aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/island')
-rw-r--r--desktop/island/ClockPill.qml5
-rw-r--r--desktop/island/Island.qml33
-rw-r--r--desktop/island/calendar/Cal.js83
-rw-r--r--desktop/island/calendar/CalendarPanel.qml74
-rw-r--r--desktop/island/calendar/EventEditor.qml39
-rw-r--r--desktop/island/calendar/test_cal.js36
6 files changed, 233 insertions, 37 deletions
diff --git a/desktop/island/ClockPill.qml b/desktop/island/ClockPill.qml
index 4ed8e38..1d18503 100644
--- a/desktop/island/ClockPill.qml
+++ b/desktop/island/ClockPill.qml
@@ -12,6 +12,7 @@
import Quickshell
import Quickshell.Widgets
import QtQuick
+import "calendar/Cal.js" as Cal
import ".."
import "../modules/vm"
import "calendar"
@@ -62,13 +63,13 @@ Capsule {
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.formatDateTime(clock.date, "ddd dd/MM")
+ text: Qt.formatDateTime(clock.date, Cal.shortDateFmt(Prefs.island.dateFormat))
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
color: Theme.subtext
}
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.formatDateTime(clock.date, "HH:mm")
+ text: Qt.formatDateTime(clock.date, Cal.timeFmt(Prefs.island.h12))
font { family: Theme.fontFamily; pixelSize: Theme.fontSize; weight: Font.DemiBold }
color: Theme.text
}
diff --git a/desktop/island/Island.qml b/desktop/island/Island.qml
index f17358d..f11225b 100644
--- a/desktop/island/Island.qml
+++ b/desktop/island/Island.qml
@@ -298,13 +298,24 @@ PanelWindow {
}
}
- // Both pills start overlapped at the sliver, above the screen edge, and
- // travel down and apart. At reveal 1 the clock ends gap/2 left of the
- // centre and the status gap/2 right of it; the status pill's left edge
- // stays put while its panel widens it.
+ // The pills start overlapped at the sliver, above the screen edge, and
+ // travel down and apart. Prefs.island.pills orders them: the first two
+ // end left of the centre, the last two right, each a gap past the visible
+ // ones nearer the centre, the nearest gap/2 from it. A pill keeps its
+ // edge facing the centre while a panel widens it, and one hidden (no
+ // player, no OBS) leaves no hole.
+ readonly property var pillOrder: Prefs.island.pills
+ function pillX(w, name) {
+ const i = win.pillOrder.indexOf(name);
+ const left = i < 2;
+ const nearer = left ? win.pillOrder.slice(i + 1, 2) : win.pillOrder.slice(2, i);
+ const byName = { media: media, clock: clock, status: status, obs: obs };
+ const off = nearer.reduce((o, n) => byName[n].visible ? o + byName[n].width + win.gap : o, win.gap / 2);
+ return win.cx - w / 2 + (left ? -1 : 1) * (off + w / 2) * win.reveal;
+ }
ClockPill {
id: clock
- x: win.cx - width / 2 - (win.gap / 2 + width / 2) * win.reveal
+ x: win.pillX(width, "clock")
y: -height + (win.top + height) * win.clockDrop
opacity: Math.min(1, win.clockDrop * 2)
flicking: win.flicking
@@ -317,7 +328,7 @@ PanelWindow {
StatusPill {
id: status
- x: win.cx - width / 2 + (win.gap / 2 + width / 2) * win.reveal
+ x: win.pillX(width, "status")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
sound: win.sound
@@ -335,8 +346,7 @@ PanelWindow {
onOpenDrawer: { win.panel = ""; win.drawer.show("sound"); }
}
- // While something plays or is paused; it sits left of the clock pill and
- // follows it as the calendar widens it. Hidden outright while the island
+ // While something plays or is paused. Hidden outright while the island
// is retracted: opacity 0 alone leaves it visible, and its marquee then
// animated off-screen for as long as anything played, repainting the
// island every frame (measured at 42% of a core, idle).
@@ -344,19 +354,18 @@ PanelWindow {
id: media
visible: win.reveal > 0
&& (Player.playing || Player.current?.playbackState === MprisPlaybackState.Paused)
- x: win.cx - width / 2 - (win.gap * 1.5 + clock.width + width / 2) * win.reveal
+ x: win.pillX(width, "media")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
}
- // While OBS runs; right of the status pill, following it as the sound
- // panel widens it.
+ // While OBS runs.
ObsPill {
id: obs
visible: Obs.connected
panel: win.panel
onOpenPanel: win.panel = "obs"
- x: win.cx - width / 2 + (win.gap * 1.5 + status.width + width / 2) * win.reveal
+ x: win.pillX(width, "obs")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
}
diff --git a/desktop/island/calendar/Cal.js b/desktop/island/calendar/Cal.js
index d8dcf80..d12ed29 100644
--- a/desktop/island/calendar/Cal.js
+++ b/desktop/island/calendar/Cal.js
@@ -83,10 +83,42 @@ function dots(events, day, calendars) {
return calendars.filter(c => events.some(e => e.calendar === c.name && onDay(e, day)));
}
-function timeLabel(ev, day) {
+// The island's clock settings (Prefs.island): h12 for a 12-hour clock, and
+// dateFormat, the clock pill's date as one of DATE_FORMATS (Qt format
+// strings). The calendar's longer dates follow its order, day or month
+// first. clockTime formats calctl's "HH:MM", compact ("9:30p") where width
+// is short.
+var DATE_GROUPS = [
+ { title: "Day first", formats: ["ddd dd/MM", "dd/MM", "dd/MM/yy", "dd/MM/yyyy", "ddd dd/MM/yyyy",
+ "dd.MM.yyyy", "dd-MM-yyyy", "d MMM", "ddd d MMM", "d MMM yyyy"] },
+ { title: "Month first", formats: ["ddd MM/dd", "MM/dd", "MM/dd/yy", "MM/dd/yyyy", "ddd MM/dd/yyyy",
+ "MMM d", "ddd MMM d", "MMM d, yyyy"] },
+ { title: "Year first", formats: ["yyyy-MM-dd", "ddd yyyy-MM-dd", "yyyy/MM/dd", "ddd MM-dd"] }];
+var DATE_FORMATS = DATE_GROUPS.reduce((a, g) => a.concat(g.formats), []);
+function timeFmt(h12) { return h12 ? "h:mm AP" : "HH:mm"; }
+function shortDateFmt(fmt) { return DATE_FORMATS.includes(fmt) ? fmt : DATE_FORMATS[0]; }
+// Day first unless the month comes before the day, the weekday name aside.
+function dayFirst(fmt) {
+ const f = shortDateFmt(fmt).replace(/ddd+/, "");
+ return f.indexOf("d") < f.indexOf("M");
+}
+function dayFmt(fmt, long) {
+ if (dayFirst(fmt)) return long ? "dddd d MMMM" : "ddd d MMM";
+ return long ? "dddd, MMMM d" : "ddd MMM d";
+}
+function clockTime(hhmm, h12) {
+ if (!h12 || !validTime(hhmm)) return hhmm;
+ const h = +hhmm.slice(0, 2);
+ return (h % 12 || 12) + hhmm.slice(2) + (h < 12 ? "a" : "p");
+}
+function hourLabel(h, h12) {
+ return h12 ? (h % 12 || 12) + (h < 12 ? "a" : "p") : pad(h);
+}
+
+function timeLabel(ev, day, h12) {
if (ev.allDay) return "all day";
- const s = ev.start.slice(0, 10) === day ? ev.start.slice(11, 16) : "…";
- const e = ev.end.slice(0, 10) === day ? ev.end.slice(11, 16) : "…";
+ const s = ev.start.slice(0, 10) === day ? clockTime(ev.start.slice(11, 16), h12) : "…";
+ const e = ev.end.slice(0, 10) === day ? clockTime(ev.end.slice(11, 16), h12) : "…";
return s + "–" + e;
}
@@ -94,22 +126,52 @@ function validTime(s) {
return /^([01]\d|2[0-3]):[0-5]\d$/.test(s);
}
+// Loose typing as HH:MM: "9.30", "9:30", "930", "9", and with am or pm
+// ("9.30pm", "12am") for the 12-hour clock, mean what they look like.
+// Anything else comes back unchanged, for validTime to reject.
+function normTime(s) {
+ const m = /^\s*(\d{1,2})(?:[:.,h ]?(\d{2}))?\s*(?:([ap])\.?m?\.?)?\s*$/i.exec(s);
+ if (!m) return s;
+ let h = +m[1];
+ if (m[3]) {
+ if (h < 1 || h > 12) return s;
+ h = h % 12 + (m[3].toLowerCase() === "p" ? 12 : 0);
+ }
+ const t = pad(h) + ":" + (m[2] || "00");
+ return validTime(t) ? t : s;
+}
+
// Step a time by minutes, wrapping within the day; an invalid time is left
// for the user to fix rather than guessed at.
function stepTime(s, minutes) {
+ s = normTime(s);
if (!validTime(s)) return s;
const m = ((+s.slice(0, 2) * 60 + +s.slice(3, 5) + minutes) % 1440 + 1440) % 1440;
return pad(Math.floor(m / 60)) + ":" + pad(m % 60);
}
-// A new event on `day`: the next whole hour, one hour long, alarm 1h (the
-// most common alarm in the live calendars). Capped at 22:00 so the end stays
-// on the same day.
-function newDraft(day, now, calendar) {
+// A new event on `day`: the next whole hour, `minutes` long (the island's
+// default event length), alarm 1h (the most common alarm in the live
+// calendars). Capped at 22:00 so a short event stays on the same day.
+function newDraft(day, now, calendar, minutes) {
const h = Math.min(22, now.getHours() + 1);
- return { uid: "", source: "", calendar: calendar, title: "", allDay: false,
- startDay: day, endDay: day, startTime: pad(h) + ":00", endTime: pad(h + 1) + ":00",
- repeat: "none", until: "", alarm: "1h", location: "", notes: "", override: false };
+ return withStart({ uid: "", source: "", calendar: calendar, title: "", allDay: false,
+ startDay: day, endDay: day, startTime: pad(h) + ":00", endTime: pad(h) + ":00",
+ repeat: "none", until: "", alarm: "1h", location: "", notes: "", override: false },
+ pad(h) + ":00", minutes);
+}
+
+// The draft with a new start time, as typed, the end following it `minutes` later,
+// into the next day if need be. A multi-day event keeps its end: snapping it
+// to the start's day would throw the other days away.
+function withStart(draft, time, minutes) {
+ const d = Object.assign({}, draft, { startTime: time });
+ const n = normTime(time);
+ if (!validTime(n) || d.startDay !== d.endDay) return d;
+ const t = +n.slice(0, 2) * 60 + +n.slice(3, 5) + (minutes > 0 ? minutes : 60);
+ d.endDay = addDays(d.startDay, Math.floor(t / 1440));
+ d.endTime = pad(Math.floor(t % 1440 / 60)) + ":" + pad(t % 60);
+ return d;
}
// calctl's event JSON as an editor draft. `source` is the calendar the event
@@ -141,6 +203,7 @@ function pick(draft, day, shift) {
// The draft as calctl's event JSON, or the first thing wrong with it.
function toPayload(d) {
+ d = Object.assign({}, d, { startTime: normTime(d.startTime), endTime: normTime(d.endTime) });
if (!d.title.trim()) return { error: "Title is empty" };
if (!d.allDay && (!validTime(d.startTime) || !validTime(d.endTime)))
return { error: "Times are HH:MM" };
diff --git a/desktop/island/calendar/CalendarPanel.qml b/desktop/island/calendar/CalendarPanel.qml
index 7d42f7d..fef672c 100644
--- a/desktop/island/calendar/CalendarPanel.qml
+++ b/desktop/island/calendar/CalendarPanel.qml
@@ -31,6 +31,7 @@ Item {
readonly property var cells: Cal.monthCells(viewY, viewM0)
readonly property real gridWidth: 252
+ readonly property bool pickingTime: panel.editing && editor.timeField !== ""
implicitHeight: Math.max(left.implicitHeight, right.implicitHeight)
@@ -81,7 +82,7 @@ Item {
}
function newEvent() {
- editor.load(Cal.newDraft(panel.selected, new Date(), Calendar.defaultCalendar));
+ editor.load(Cal.newDraft(panel.selected, new Date(), Calendar.defaultCalendar, Prefs.island.eventMinutes));
panel.editing = true;
}
@@ -113,12 +114,14 @@ Item {
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.locale().standaloneMonthName(panel.viewM0) + " " + panel.viewY
+ text: panel.pickingTime ? (editor.timeField === "startTime" ? "Start" : "End") + " time"
+ : Qt.locale().standaloneMonthName(panel.viewM0) + " " + panel.viewY
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
}
Row {
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ visible: !panel.pickingTime
spacing: 12
Repeater {
model: [{ t: "‹", n: -1 }, { t: "›", n: 1 }]
@@ -140,6 +143,7 @@ Item {
Grid {
columns: 7
spacing: 2
+ visible: !panel.pickingTime
Repeater {
model: [0, 1, 2, 3, 4, 5, 6]
@@ -208,6 +212,66 @@ Item {
}
}
}
+ // While a time field has focus: hours, then minutes. Typing still
+ // works, the field keeps the focus.
+ Grid {
+ id: hours
+ readonly property string cur: panel.pickingTime ? Cal.normTime(editor.draft[editor.timeField]) : ""
+ visible: panel.pickingTime
+ columns: 6
+ spacing: 2
+
+ Repeater {
+ model: 24
+ delegate: TimeCell {
+ required property int index
+ width: (panel.gridWidth - 10) / 6
+ label: Cal.hourLabel(index, Prefs.island.h12)
+ on: hours.cur.slice(0, 2) === Cal.pad(index)
+ onClicked: editor.pickTime(index, null)
+ }
+ }
+ }
+ Row {
+ id: minutes
+ readonly property string cur: panel.pickingTime ? Cal.normTime(editor.draft[editor.timeField]) : ""
+ visible: panel.pickingTime
+ spacing: 2
+
+ Repeater {
+ model: ["00", "15", "30", "45"]
+ delegate: TimeCell {
+ required property string modelData
+ width: (panel.gridWidth - 6) / 4
+ label: ":" + modelData
+ on: minutes.cur.slice(2) === label
+ onClicked: editor.pickTime(null, modelData)
+ }
+ }
+ }
+ }
+
+ component TimeCell: Rectangle {
+ property string label: ""
+ property bool on: false
+ signal clicked()
+ height: 32
+ radius: 8
+ color: on ? Qt.alpha(Theme.accent, 0.35)
+ : cellHover.containsMouse ? Qt.alpha(Theme.surface, 0.8) : "transparent"
+ Text {
+ anchors.centerIn: parent
+ text: parent.label
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ MouseArea {
+ id: cellHover
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: parent.clicked()
+ }
}
// --- right: agenda or editor -------------------------------------------
@@ -227,7 +291,7 @@ Item {
Text {
text: panel.selected === "" ? ""
: Qt.formatDate(new Date(+panel.selected.slice(0, 4), +panel.selected.slice(5, 7) - 1,
- +panel.selected.slice(8, 10)), "dddd d MMMM")
+ +panel.selected.slice(8, 10)), Cal.dayFmt(Prefs.island.dateFormat, true))
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
}
@@ -263,9 +327,9 @@ Item {
Text {
id: when
x: 16
- width: 82
+ width: Prefs.island.h12 ? 92 : 82
anchors.verticalCenter: parent.verticalCenter
- text: Cal.timeLabel(row.modelData, panel.selected)
+ text: Cal.timeLabel(row.modelData, panel.selected, Prefs.island.h12)
color: Theme.subtext
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 }
}
diff --git a/desktop/island/calendar/EventEditor.qml b/desktop/island/calendar/EventEditor.qml
index 510c844..e55396b 100644
--- a/desktop/island/calendar/EventEditor.qml
+++ b/desktop/island/calendar/EventEditor.qml
@@ -24,6 +24,10 @@ Column {
property bool confirmDelete: false
property bool busy: false
property string err: ""
+ // The time field with focus, if any: the panel swaps the month for an
+ // hour and minute picker while one has it.
+ readonly property string timeField: startTime.input.activeFocus ? "startTime"
+ : endTime.input.activeFocus ? "endTime" : ""
signal done()
@@ -49,6 +53,29 @@ Column {
ed.draft = d;
}
+ function setTime(key, value) {
+ (key === "startTime" ? startTime : endTime).input.text = value;
+ if (key === "startTime") ed.setStart(value);
+ else ed.set(key, value);
+ }
+
+ // The end follows the start by the island's default event length.
+ function setStart(text) {
+ ed.draft = Cal.withStart(ed.draft, text, Prefs.island.eventMinutes);
+ endTime.input.text = ed.draft.endTime;
+ }
+
+ // A click in the time picker: an hour keeps the minutes, a minute keeps
+ // the hour and moves on, start to end, end out of the fields.
+ function pickTime(h, m) {
+ const key = ed.timeField;
+ if (!key) return;
+ const cur = Cal.normTime(ed.draft[key]);
+ const old = Cal.validTime(cur) ? cur : "09:00";
+ ed.setTime(key, (h !== null ? Cal.pad(h) : old.slice(0, 2)) + ":" + (m !== null ? m : old.slice(3, 5)));
+ if (m !== null) (key === "startTime" ? endTime.input : ed).forceActiveFocus();
+ }
+
function pick(day, shift) {
if (ed.pickUntil) {
ed.set("until", day);
@@ -82,7 +109,7 @@ Column {
function dayLabel(day) {
const d = new Date(+day.slice(0, 4), +day.slice(5, 7) - 1, +day.slice(8, 10));
- return Qt.formatDate(d, "ddd d MMM");
+ return Qt.formatDate(d, Cal.dayFmt(Prefs.island.dateFormat, false));
}
// An unhandled Escape from any field lands here: leave the editor, not
@@ -175,7 +202,8 @@ Column {
id: startTime
width: 62
visible: !ed.draft.allDay
- input.onTextEdited: ed.set("startTime", input.text)
+ input.onTextEdited: ed.setStart(input.text)
+ input.onEditingFinished: if (Cal.normTime(input.text) !== input.text) ed.setTime("startTime", Cal.normTime(input.text))
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
@@ -183,8 +211,7 @@ Column {
onWheel: wheel => {
acc += wheel.angleDelta.y;
if (Math.abs(acc) < 120) return;
- parent.input.text = Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15);
- ed.set("startTime", parent.input.text);
+ ed.setTime("startTime", Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15));
acc = 0;
}
}
@@ -200,6 +227,7 @@ Column {
width: 62
visible: !ed.draft.allDay
input.onTextEdited: ed.set("endTime", input.text)
+ input.onEditingFinished: if (Cal.normTime(input.text) !== input.text) ed.setTime("endTime", Cal.normTime(input.text))
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
@@ -207,8 +235,7 @@ Column {
onWheel: wheel => {
acc += wheel.angleDelta.y;
if (Math.abs(acc) < 120) return;
- parent.input.text = Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15);
- ed.set("endTime", parent.input.text);
+ ed.setTime("endTime", Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15));
acc = 0;
}
}
diff --git a/desktop/island/calendar/test_cal.js b/desktop/island/calendar/test_cal.js
index 9d0d147..5a9c1c0 100644
--- a/desktop/island/calendar/test_cal.js
+++ b/desktop/island/calendar/test_cal.js
@@ -17,7 +17,7 @@ const assert = require("assert");
const src = fs.readFileSync(__dirname + "/Cal.js", "utf8").replace(/^\.pragma library$/m, "");
const C = new Function(src + "\nreturn { pad, addDays, today, daysBetween, monthCells, shiftMonth," +
- " lastDay, onDay, dayEvents, dots, timeLabel, validTime, stepTime, newDraft, fromEvent, pick," +
+ " lastDay, onDay, dayEvents, dots, timeLabel, validTime, normTime, clockTime, hourLabel, shortDateFmt, dayFmt, stepTime, newDraft, withStart, fromEvent, pick," +
" toPayload };")();
// Dates are plain YYYY-MM-DD strings, arithmetic in UTC so DST never moves a day.
@@ -76,6 +76,26 @@ assert.strictEqual(C.stepTime("14:30", 15), "14:45");
assert.strictEqual(C.stepTime("23:50", 15), "00:05");
assert.strictEqual(C.stepTime("00:05", -15), "23:50");
assert.strictEqual(C.stepTime("bad", 15), "bad");
+assert.strictEqual(C.stepTime("9.30", 15), "09:45");
+for (const [i, o] of [["9.30", "09:30"], ["9:30", "09:30"], ["930", "09:30"], ["1230", "12:30"],
+ ["9", "09:00"], [" 14h15 ", "14:15"], ["09:05", "09:05"],
+ ["24.00", "24.00"], ["9.30pm", "21:30"], ["12am", "00:00"], ["12 PM", "12:00"],
+ ["9:30 a.m.", "09:30"], ["13pm", "13pm"], ["9.7", "9.7"], ["ab", "ab"], ["", ""]])
+ assert.strictEqual(C.normTime(i), o, i);
+
+// The 12-hour clock, compact; 24-hour leaves calctl's time alone.
+assert.strictEqual(C.clockTime("00:05", true), "12:05a");
+assert.strictEqual(C.clockTime("12:00", true), "12:00p");
+assert.strictEqual(C.clockTime("21:30", true), "9:30p");
+assert.strictEqual(C.clockTime("21:30", false), "21:30");
+assert.strictEqual(C.hourLabel(0, true), "12a");
+assert.strictEqual(C.hourLabel(13, true), "1p");
+assert.strictEqual(C.hourLabel(7, false), "07");
+assert.strictEqual(C.shortDateFmt("bogus"), "ddd dd/MM");
+assert.strictEqual(C.dayFmt("ddd MM/dd", false), "ddd MMM d");
+assert.strictEqual(C.dayFmt("ddd dd/MM", true), "dddd d MMMM");
+assert.strictEqual(C.dayFmt("yyyy-MM-dd", false), "ddd MMM d");
+assert.strictEqual(C.dayFmt("d MMM yyyy", false), "ddd d MMM");
// A new event: the next whole hour, one hour long, alarm 1h.
const d = C.newDraft("2026-10-20", new Date(2026, 9, 13, 9, 20), "home");
@@ -86,6 +106,17 @@ assert.strictEqual(d.alarm, "1h");
assert.strictEqual(d.calendar, "home");
assert.strictEqual(d.source, "");
assert.strictEqual(C.newDraft("2026-10-20", new Date(2026, 9, 13, 23, 10), "home").startTime, "22:00");
+assert.strictEqual(C.newDraft("2026-10-20", new Date(2026, 9, 13, 9, 20), "home", 90).endTime, "11:30");
+
+// The end follows the start, by the default length, past midnight too.
+const w = C.withStart(d, "23:30", 60);
+assert.strictEqual(w.startTime, "23:30");
+assert.strictEqual(w.endTime, "00:30");
+assert.strictEqual(w.endDay, "2026-10-21");
+assert.strictEqual(C.withStart(d, "14:00", 45).endTime, "14:45");
+assert.strictEqual(C.withStart(d, "9.3", 60).endTime, "11:00");
+const multi = Object.assign({}, d, { endDay: "2026-10-22", endTime: "18:00" });
+assert.strictEqual(C.withStart(multi, "08:00", 60).endTime, "18:00");
// From calctl's JSON.
const fe = C.fromEvent({ uid: "u", calendar: "home", title: "Trip", allDay: true, start: "2026-10-14",
@@ -111,7 +142,8 @@ assert.strictEqual(p3.endDay, "2026-10-16");
// To calctl's JSON.
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: " " })).error, "Title is empty");
-assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "9:00" })).error, "Times are HH:MM");
+assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "9:00" })).payload.start.slice(11), "09:00");
+assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "25:00" })).error, "Times are HH:MM");
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", endTime: "09:00" })).error, "End is before start");
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", repeat: "weekly", until: "2026-10-01" })).error,
"Until is before the start");