Skip to content
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

Fix Calendar Issues #636

Merged
merged 1 commit into from
Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed
- Installer: Use init config.js from config.js.sample.
- Switched out `rrule` package for `rrule-alt` in order to improve calendar issues. (Experimental: [#565](https://github.com/MichMich/MagicMirror/issues/565))
- Switched out `rrule` package for `rrule-alt` and fixes in `ical.js` in order to fix calendar issues. ([#565](https://github.com/MichMich/MagicMirror/issues/565))
- Make mouse events pass through the region fullscreen_above to modules below.
- Scaled the splash screen down to make it a bit more subtle.
- Replace HTML tables with markdown tables in README files.
Expand Down
12 changes: 11 additions & 1 deletion modules/default/calendar/vendor/ical.js/ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
return dt
}


var dateParam = function(name){
return function(val, params, curr){

Expand Down Expand Up @@ -143,6 +142,16 @@
}
}

var exdateParam = function(name){
return function(val, params, curr){
var date = dateParam(name)(val, params, curr);
if (date.exdates === undefined) {
date.exdates = [];
}
date.exdates.push(date.exdate);
return date;
}
}

var geoParam = function(name){
return function(val, params, curr){
Expand Down Expand Up @@ -240,6 +249,7 @@
, 'LOCATION' : storeParam('location')
, 'DTSTART' : dateParam('start')
, 'DTEND' : dateParam('end')
, 'EXDATE' : exdateParam('exdate')
,' CLASS' : storeParam('class')
, 'TRANSP' : storeParam('transparency')
, 'GEO' : geoParam('geo')
Expand Down
11 changes: 8 additions & 3 deletions modules/default/calendar/vendor/ical.js/node-ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports.parseFile = function(filename){


var rrule = require('rrule-alt').RRule
var rrulestr = rrule.rrulestr

ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
curr.rrule = line;
Expand All @@ -26,7 +27,7 @@ ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
var originalEnd = ical.objectHandlers['END'];
ical.objectHandlers['END'] = function(val, params, curr, stack){
if (curr.rrule) {
var rule = curr.rrule.replace('RRULE:', '');
var rule = curr.rrule;
if (rule.indexOf('DTSTART') === -1) {

if (curr.start.length === 8) {
Expand All @@ -36,10 +37,14 @@ ical.objectHandlers['END'] = function(val, params, curr, stack){
}
}

rule += ';DTSTART=' + curr.start.toISOString().replace(/[-:]/g, '');
rule += ' DTSTART:' + curr.start.toISOString().replace(/[-:]/g, '');
rule = rule.replace(/\.[0-9]{3}/, '');
}
curr.rrule = rrule.fromString(rule);
for (var i in curr.exdates) {
rule += ' EXDATE:' + curr.exdates[i].toISOString().replace(/[-:]/g, '');
rule = rule.replace(/\.[0-9]{3}/, '');
}
curr.rrule = rrulestr(rule);
}
return originalEnd.call(this, val, params, curr, stack);
}