-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix crash on rrule.between returned bad dates #3256 #3257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fd2e95d
fix rrule.between crash on bad dates #3256
sdetweil f76f3c1
add changelog
sdetweil e2d7844
Merge branch 'develop' into fix_bad_rrule
sdetweil 6f8dc9d
update missing # on issue number
sdetweil c2df702
Update bad_rrule.js for correct author attribution
sdetweil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.eslintignore | ||
.prettierignore | ||
/config | ||
/coverage | ||
package-lock.json | ||
**.ics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* MagicMirror² Test config default calendar with auth by default | ||
* | ||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com | ||
sdetweil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* MIT Licensed. | ||
*/ | ||
let config = { | ||
timeFormat: 12, | ||
logLevel: ["INFO", "LOG", "WARN", "ERROR", "DEBUG"], | ||
modules: [ | ||
{ | ||
module: "calendar", | ||
position: "bottom_bar", | ||
config: { | ||
calendars: [ | ||
{ | ||
url: "http://localhost:8080/tests/mocks/bad_rrule.ics" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") { | ||
module.exports = config; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTAMP:20210413T203456Z | ||
UID:E689AEB8C02C4E2CADD8C7D3D303CEAD0 | ||
DTSTART;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T190000 | ||
DTEND;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T210000 | ||
CLASS:PUBLIC | ||
LOCATION:albert heijn | ||
SUMMARY:xxx xxxx | ||
SEQUENCE:10 | ||
RRULE:FREQ=DAILY;UNTIL=20210418T170000Z | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210417T190000 | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210416T190000 | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T190000 | ||
BEGIN:VALARM | ||
ACTION:DISPLAY | ||
TRIGGER;RELATED=START:-PT15M | ||
END:VALARM | ||
END:VEVENT | ||
END:VCALENDAR |
29 changes: 29 additions & 0 deletions
29
tests/unit/modules/default/calendar/calendar_fetcher_utils_bad_rrule.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
global.moment = require("moment-timezone"); | ||
|
||
const CalendarFetcherUtils = require("../../../../../modules/default/calendar/calendarfetcherutils"); | ||
|
||
describe("Calendar fetcher utils test", () => { | ||
const defaultConfig = { | ||
excludedEvents: [] | ||
}; | ||
|
||
describe("filterEvents", () => { | ||
it("no events, not crash", () => { | ||
const minusOneHour = moment().subtract(1, "hours").toDate(); | ||
const minusTwoHours = moment().subtract(2, "hours").toDate(); | ||
const plusOneHour = moment().add(1, "hours").toDate(); | ||
const plusTwoHours = moment().add(2, "hours").toDate(); | ||
|
||
const filteredEvents = CalendarFetcherUtils.filterEvents( | ||
{ | ||
pastEvent: { type: "VEVENT", start: minusTwoHours, end: minusOneHour, summary: "pastEvent" }, | ||
ongoingEvent: { type: "VEVENT", start: minusOneHour, end: plusOneHour, summary: "ongoingEvent" }, | ||
upcomingEvent: { type: "VEVENT", start: plusOneHour, end: plusTwoHours, summary: "upcomingEvent" } | ||
}, | ||
defaultConfig | ||
); | ||
|
||
expect(filteredEvents.length).toEqual(0); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.