Allow to parse recurring calendar events where the start date is before 1900

Some birthday calendar events have a start date before 1900.
This commit is contained in:
Thomas Bachmann 2018-10-03 22:43:29 +02:00
parent 3f083862e7
commit 007b2f0c88
4 changed files with 7 additions and 8 deletions

View File

@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
### Fixed
- Allow to parse recurring calendar events where the start date is before 1970
- Allow to parse recurring calendar events where the start date is before 1900
### Updated

View File

@ -1,7 +1,6 @@
# Module: Calendar
The `calendar` module is one of the default modules of the MagicMirror.
This module displays events from a public .ical calendar. It can combine multiple calendars.
Note that calendars may not contain any entry before 1st January 1970, otherwise the calendar won't be displayed and the module will crash.
## Using the module

View File

@ -174,11 +174,11 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if (typeof event.rrule != "undefined" && !isFacebookBirthday) {
var rule = event.rrule;
// can cause problems with birthdays before 1970
if(rule.origOptions && rule.origOptions.dtstart && rule.origOptions.dtstart.getFullYear() < 1970 ||
rule.options && rule.options.dtstart && rule.options.dtstart.getFullYear() < 1970){
rule.origOptions.dtstart.setYear(1970);
rule.options.dtstart.setYear(1970);
// can cause problems with e.g. birthdays before 1900
if(rule.origOptions && rule.origOptions.dtstart && rule.origOptions.dtstart.getFullYear() < 1900 ||
rule.options && rule.options.dtstart && rule.options.dtstart.getFullYear() < 1900){
rule.origOptions.dtstart.setYear(1900);
rule.options.dtstart.setYear(1900);
}
var dates = rule.between(today, future, true, limitFunction);

View File

@ -66,7 +66,7 @@
"mocha-logger": "^1.0.5",
"moment": "latest",
"request": "^2.83.0",
"rrule-alt": "^2.2.7",
"rrule-alt": "^2.2.8",
"simple-git": "^1.85.0",
"socket.io": "^2.0.4",
"valid-url": "latest",