Skip to content

Commit af77b7b

Browse files
authored
fix #3701, calculation wrong, added testcase, ics, config (#3702)
fixes #3701 offset calculation wrong when user looking back at east coast event added testcase
1 parent 53ac31d commit af77b7b

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ planned for 2025-04-01
3535
- [calendar] Fix arrayed symbols, #3267, again, add testcase, add testcase for #3678
3636
- [weather] Fix wrong weatherCondition name in openmeteo provider which lead to n/a icon (#3691)
3737
- [core] Fix wrong port in log message when starting server only (#3696)
38+
- [calendar] NewYork event processed on system in Central timezone shows wrong time #3701
3839

3940
## [2.30.0] - 2025-01-01
4041

modules/default/calendar/calendarfetcherutils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,11 @@ const CalendarFetcherUtils = {
662662
Log.debug("signs are the same");
663663
if (Math.sign(eventDiff) === -1) {
664664
//if west, looking at more west
665+
// -350 <-300
665666
if (nowDiff < eventDiff) {
666667
//-600 -420
667-
eventDiff = -(eventDiff - (nowDiff - eventDiff)); //-180
668+
//300 -300 -360 +300
669+
eventDiff = nowDiff - eventDiff; //-180
668670
Log.debug("now looking back east delta diff=", eventDiff);
669671
}
670672
else {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
let config = {
2+
address: "0.0.0.0",
3+
ipWhitelist: [],
4+
5+
timeFormat: 24,
6+
modules: [
7+
{
8+
module: "calendar",
9+
position: "bottom_bar",
10+
config: {
11+
fade: false,
12+
urgency: 0,
13+
dateFormat: "Do.MMM, HH:mm",
14+
fullDayEventDateFormat: "Do.MMM",
15+
timeFormat: "absolute",
16+
getRelative: 0,
17+
maximumNumberOfDays: 28,
18+
showEnd: true,
19+
calendars: [
20+
{
21+
maximumEntries: 100,
22+
url: "http://localhost:8080/tests/mocks/chicago-nyedge.ics"
23+
}
24+
]
25+
}
26+
}
27+
]
28+
};
29+
30+
/*************** DO NOT EDIT THE LINE BELOW ***************/
31+
if (typeof module !== "undefined") {
32+
module.exports = config;
33+
}

tests/electron/modules/calendar_spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ describe("Calendar module", () => {
253253
// just
254254
await expect(doTestTableContent(".calendar .event", ".time", "29th.Oct, 05:00-30th.Oct, 18:00", first)).resolves.toBe(true);
255255
});
256+
it("viewing from further west in diff timezones", async () => {
257+
await helpers.startApplication("tests/configs/modules/calendar/chicago-looking-at-ny-recurring.js", "22 Jan 2025 14:30:00 GMT-06:00", [], "America/Chicago");
258+
// just
259+
await expect(doTestTableContent(".calendar .event", ".time", "22nd.Jan, 17:30-19:30", first)).resolves.toBe(true);
260+
});
256261
});
257262

258263
describe("one event non repeating", () => {

tests/mocks/chicago-nyedge.ics

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BEGIN:VEVENT
2+
DTSTART;TZID=America/New_York:20240918T183000
3+
DTEND;TZID=America/New_York:20240918T203000
4+
RRULE:FREQ=WEEKLY;BYDAY=WE
5+
EXDATE;TZID=America/New_York:20241127T183000
6+
EXDATE;TZID=America/New_York:20241225T183000
7+
DTSTAMP:20250122T045443Z
8+
9+
CREATED:20240916T131843Z
10+
LAST-MODIFIED:20241222T235014Z
11+
SEQUENCE:0
12+
STATUS:CONFIRMED
13+
SUMMARY:Derby
14+
TRANSP:OPAQUE
15+
END:VEVENT

0 commit comments

Comments
 (0)