Skip to content

Commit

Permalink
Merge pull request #636 from Jopyth/fix_calendar
Browse files Browse the repository at this point in the history
Fix Calendar Issues
  • Loading branch information
MichMich authored Jan 22, 2017
2 parents 3dd3afd + 63819c5 commit 1f78630
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
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);
}

0 comments on commit 1f78630

Please sign in to comment.