dateMenu: Don't manipulate passed events
The event passed to formatEventTime() is reused at a later point.
Therefore, we are not allowed to manipulate the event directly.
This fixes an issue where the user clicks on a multi-day all-day event
the second time before the event gets garbage collected and the event
then is one day shorter.
Fixes 528ee01fef
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2184>
This commit is contained in:
parent
8655814329
commit
0fded45c76
@ -175,7 +175,7 @@ class EventsSection extends St.Button {
|
|||||||
|
|
||||||
_formatEventTime(event) {
|
_formatEventTime(event) {
|
||||||
const eventStart = event.date;
|
const eventStart = event.date;
|
||||||
const eventEnd = event.end;
|
let eventEnd = event.end;
|
||||||
|
|
||||||
const allDay =
|
const allDay =
|
||||||
eventStart.getTime() === this._startDate.getTime() && eventEnd.getTime() === this._endDate.getTime();
|
eventStart.getTime() === this._startDate.getTime() && eventEnd.getTime() === this._endDate.getTime();
|
||||||
@ -203,8 +203,10 @@ class EventsSection extends St.Button {
|
|||||||
|
|
||||||
const startYear = eventStart.getFullYear();
|
const startYear = eventStart.getFullYear();
|
||||||
|
|
||||||
if (endsAtMidnight)
|
if (endsAtMidnight) {
|
||||||
|
eventEnd = new Date(eventEnd);
|
||||||
eventEnd.setDate(eventEnd.getDate() - 1);
|
eventEnd.setDate(eventEnd.getDate() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
const endYear = eventEnd.getFullYear();
|
const endYear = eventEnd.getFullYear();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user