[#425] Event title modification of all day event alter event dates (#431)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-12-18 09:09:02 +01:00
committed by GitHub
parent 403517e827
commit 90d6058b0f
4 changed files with 10 additions and 11 deletions
+3 -3
View File
@@ -513,12 +513,12 @@ describe("calendarEventToJCal", () => {
);
});
it("converts all-day events adjusting dtend", () => {
it("converts all-day events", () => {
const mockEvent: any = {
uid: "event-11",
title: "All Day",
start: "2025-07-21T00:00:00.000Z",
end: "2025-07-21T00:00:00.000Z",
end: "2025-07-22T00:00:00.000Z",
timezone: "Europe/Paris",
allday: true,
attendee: [],
@@ -542,7 +542,7 @@ describe("calendarEventToJCal", () => {
calId: "test/test",
title: "Team Meeting",
start: "2025-07-23T00:00:00.000Z",
end: "2025-07-23T00:00:00.000Z",
end: "2025-07-24T00:00:00.000Z",
timezone: "Europe/Paris",
transp: "OPAQUE",
class: "PUBLIC",
+6 -3
View File
@@ -994,18 +994,21 @@ function formatEnd(
const formatDatePart = (d: Date) =>
d.toLocaleDateString("en-CA", { timeZone }); // YYYY-MM-DD format
const sameDay = formatDatePart(startDate) === formatDatePart(endDate);
if (allday) {
const inclusiveEndDate = new Date(endDate);
inclusiveEndDate.setDate(inclusiveEndDate.getDate() - 1);
const sameDay =
formatDatePart(startDate) === formatDatePart(inclusiveEndDate);
return sameDay
? null
: endDate.toLocaleDateString(t("locale"), {
: inclusiveEndDate.toLocaleDateString(t("locale"), {
year: "numeric",
month: "short",
day: "numeric",
timeZone,
});
} else {
const sameDay = formatDatePart(startDate) === formatDatePart(endDate);
if (sameDay) {
return endDate.toLocaleTimeString(t("locale"), {
hour: "2-digit",
+1
View File
@@ -247,6 +247,7 @@ function EventUpdateModal({
if (isAllDay) {
// For all-day events, use date format (YYYY-MM-DD)
const endDate = new Date(event.end);
endDate.setDate(endDate.getDate() - 1);
setEnd(endDate.toISOString().split("T")[0]);
} else {
// For timed events, format in the event's original timezone
-5
View File
@@ -331,11 +331,6 @@ export function makeVevent(
const endDate = new Date(event.end);
let finalEndDate = endDate;
if (event.allday && endDate.getTime() === startDate.getTime()) {
finalEndDate = new Date(endDate);
finalEndDate.setDate(startDate.getDate() + 1);
}
vevent[1].push([
"dtend",
{ tzid },