Skip to content

Commit 613a8dd

Browse files
authored
Merge pull request #50 from ProLoser/copilot/fix-calendar-button-event-date
2 parents cb03582 + a2d6d49 commit 613a8dd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

19hz/map.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,17 @@ class Events {
759759

760760
// Parse start time properly
761761
const startTime = Events.parseTime12Hour(time[0]);
762-
const start = new Date(event.date);
762+
// Parse date string as local date to avoid timezone issues
763+
const [year, month, day] = event.date.split('-').map(Number);
764+
const start = new Date(year, month - 1, day);
763765
start.setHours(startTime.hours, startTime.minutes, 0, 0);
764766
const startDate = start.toLocaleDateString('sv-SE'); // outputs yyyy-mm-dd
765767

766768
let end;
767769
if (time[1]) {
768770
const endTime = Events.parseTime12Hour(time[1]);
769-
end = new Date(event.date);
771+
// Reuse parsed date components from start date
772+
end = new Date(year, month - 1, day);
770773
end.setHours(endTime.hours, endTime.minutes, 0, 0);
771774

772775
// Is event overnight? (end time is earlier than start time)

0 commit comments

Comments
 (0)