mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 10:22:29 +08:00
fix(calendar): handling of start time/end time
This commit is contained in:
parent
680729de63
commit
55ccbfe1cc
@ -169,7 +169,7 @@ describe("Promoted attributes", () => {
|
||||
const events = await CalendarView.buildEvents(noteIds);
|
||||
|
||||
expect(events).toHaveLength(2);
|
||||
expect(events[0]).toMatchObject({ title: "Note 1", start: "2025-05-05T13:30:00", end: "2025-05-05T13:30:00" });
|
||||
expect(events[0]).toMatchObject({ title: "Note 1", start: "2025-05-05T13:30:00" });
|
||||
expect(events[1]).toMatchObject({ title: "Note 2", start: "2025-05-07T13:36:00", end: "2025-05-08" });
|
||||
});
|
||||
|
||||
|
@ -384,15 +384,15 @@ export default class CalendarView extends ViewMode {
|
||||
}
|
||||
|
||||
for (const title of titles) {
|
||||
if (endTime && !endDate) {
|
||||
endDate = startDate;
|
||||
}
|
||||
|
||||
startDate = (startTime ? `${startDate}T${startTime}:00` : startDate);
|
||||
if (!endDate) {
|
||||
if (!endTime) {
|
||||
endDate = startDate;
|
||||
} else {
|
||||
const endDateOffset = CalendarView.#offsetDate(endDate ?? startDate, 1);
|
||||
if (endDateOffset) {
|
||||
endDate = CalendarView.#formatDateToLocalISO(endDateOffset);
|
||||
}
|
||||
if (!endDate && !startTime) {
|
||||
const endDateOffset = CalendarView.#offsetDate(endDate ?? startDate, 1);
|
||||
if (endDateOffset) {
|
||||
endDate = CalendarView.#formatDateToLocalISO(endDateOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user