Skip to content

Commit

Permalink
Revert "fix: Issue #1798 - fixing recurrent calendar events crosstime…
Browse files Browse the repository at this point in the history
… DST"
  • Loading branch information
MichMich committed Jan 18, 2020
1 parent d6f1bf1 commit b515b5f
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 236 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Expand Up @@ -19,7 +19,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Force declaration of public ip adress in config file (ISSUE #1852)
- Fixes `run-start.sh`: If running in docker-container, don't check the environment, just start electron (ISSUE #1859)
- Fix calendar time offset for recurring events crossing Daylight Savings Time (ISSUE #1798)

### Updated
- Remove documentation from core repository and link to new dedicated docs site: [docs.magicmirror.builders](https://docs.magicmirror.builders).
Expand Down
4 changes: 2 additions & 2 deletions config/config.js.sample
Expand Up @@ -25,11 +25,11 @@ var config = {
timeFormat: 24,
units: "metric",
// serverOnly: true/false/"local" ,
// local for armv6l processors, default
// local for armv6l processors, default
// starts serveronly and then starts chrome browser
// false, default for all NON-armv6l devices
// true, force serveronly mode, because you want to.. no UI on this device

modules: [
{
module: "alert",
Expand Down
9 changes: 1 addition & 8 deletions modules/default/calendar/calendarfetcher.js
Expand Up @@ -184,14 +184,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri

// For recurring events, get the set of start dates that fall within the range
// of dates we"re looking for.
// kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time
var pastLocal = moment(past).subtract(past.getTimezoneOffset(), "minutes").toDate();
var futureLocal = moment(future).subtract(future.getTimezoneOffset(), "minutes").toDate();
var datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction);
var dates = datesLocal.map(function(dateLocal) {
var date = moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate();
return date;
});
var dates = rule.between(past, future, true, limitFunction);

// The "dates" array contains the set of dates within our desired date range range that are valid
// for the recurrence rule. *However*, it"s possible for us to have a specific recurrence that
Expand Down
15 changes: 2 additions & 13 deletions modules/default/calendar/vendor/ical.js/node-ical.js
Expand Up @@ -26,17 +26,6 @@ exports.parseFile = function(filename){

var rrule = require('rrule').RRule

function getLocaleISOString(date) {
var year = date.getFullYear().toString(10).padStart(4,'0');
var month = date.getMonth().toString(10).padStart(2,'0');
var day = date.getDate().toString(10).padStart(2,'0');
var hour = date.getHours().toString(10).padStart(2,'0');
var minute = date.getMinutes().toString(10).padStart(2,'0');
var second = date.getSeconds().toString(10).padStart(2,'0');

return `${year}${month}${day}T${hour}${minute}${second}Z`;
}

ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
curr.rrule = line;
return curr
Expand All @@ -61,8 +50,8 @@ ical.objectHandlers['END'] = function (val, params, curr, stack) {

if (typeof curr.start.toISOString === 'function') {
try {
// kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time
rule += ';DTSTART=' + getLocaleISOString(curr.start);
rule += ';DTSTART=' + curr.start.toISOString().replace(/[-:]/g, '');
rule = rule.replace(/\.[0-9]{3}/, '');
} catch (error) {
console.error("ERROR when trying to convert to ISOString", error);
}
Expand Down
22 changes: 11 additions & 11 deletions modules/default/compliments/compliments.js
Expand Up @@ -39,7 +39,7 @@ Module.register("compliments", {
afternoonEndTime: 17,
random: true
},
lastIndexUsed:-1,
lastIndexUsed:-1,
// Set currentweather from module
currentWeatherType: "",

Expand Down Expand Up @@ -151,7 +151,7 @@ Module.register("compliments", {
// get the current time of day compliments list
var compliments = this.complimentArray();
// variable for index to next message to display
let index=0;
let index=0
// are we randomizing
if(this.config.random){
// yes
Expand All @@ -160,28 +160,28 @@ Module.register("compliments", {
else{
// no, sequetial
// if doing sequential, don't fall off the end
index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed;
index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed
}

return compliments[index];
},

// Override dom generator.
// Override dom generator.
getDom: function() {
var wrapper = document.createElement("div");
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
// get the compliment text
// get the compliment text
var complimentText = this.randomCompliment();
// split it into parts on newline text
var parts= complimentText.split("\n");
// split it into parts on newline text
var parts= complimentText.split('\n')
// create a span to hold it all
var compliment=document.createElement("span");
// process all the parts of the compliment text
var compliment=document.createElement('span')
// process all the parts of the compliment text
for (part of parts){
// create a text element for each part
compliment.appendChild(document.createTextNode(part));
compliment.appendChild(document.createTextNode(part))
// add a break `
compliment.appendChild(document.createElement("BR"));
compliment.appendChild(document.createElement('BR'))
}
// remove the last break
compliment.lastElementChild.remove();
Expand Down
46 changes: 23 additions & 23 deletions tests/configs/modules/weather/forecastweather_default.js
Expand Up @@ -6,31 +6,31 @@
*/

let config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],

language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},

modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
apiKey: "fake key",
weatherEndpoint: "/forecast/daily",
initialLoadDelay: 3000
}
}
]
modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
apiKey: "fake key",
weatherEndpoint: "/forecast/daily",
initialLoadDelay: 3000
}
}
]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
Expand Down
52 changes: 26 additions & 26 deletions tests/configs/modules/weather/forecastweather_options.js
Expand Up @@ -6,34 +6,34 @@
*/

let config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],

language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},

modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
apiKey: "fake key",
weatherEndpoint: "/forecast/daily",
initialLoadDelay: 3000,
showPrecipitationAmount: true,
colored: true,
tableClass: "myTableClass"
}
}
]
modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
apiKey: "fake key",
weatherEndpoint: "/forecast/daily",
initialLoadDelay: 3000,
showPrecipitationAmount: true,
colored: true,
tableClass: "myTableClass"
}
}
]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
Expand Down
98 changes: 49 additions & 49 deletions tests/e2e/modules/mocks/weather_current.js
@@ -1,54 +1,54 @@
const _ = require("lodash");
const _ = require('lodash');

function generateWeather(extendedData = {}) {
return JSON.stringify(_.merge({}, {
coord:{
lon: 11.58,
lat: 48.14
},
weather:[
{
id: 615,
main: "Snow",
description: "light rain and snow",
icon: "13d"
},
{
id: 500,
main: "Rain",
description: "light rain",
icon: "10d"
}
],
base: "stations",
main:{
temp: 1.49,
pressure: 1005,
humidity: 93.7,
temp_min: 1,
temp_max: 2
},
visibility: 7000,
wind:{
speed: 11.8,
deg: 250
},
clouds:{
all: 75
},
dt: 1547387400,
sys:{
type: 1,
id: 1267,
message: 0.0031,
country: "DE",
sunrise: 1547362817,
sunset: 1547394301
},
id: 2867714,
name: "Munich",
cod: 200
}, extendedData));
return JSON.stringify(_.merge({}, {
coord:{
lon: 11.58,
lat: 48.14
},
weather:[
{
id: 615,
main: "Snow",
description: "light rain and snow",
icon: "13d"
},
{
id: 500,
main: "Rain",
description: "light rain",
icon: "10d"
}
],
base: "stations",
main:{
temp: 1.49,
pressure: 1005,
humidity: 93.7,
temp_min: 1,
temp_max: 2
},
visibility: 7000,
wind:{
speed: 11.8,
deg: 250
},
clouds:{
all: 75
},
dt: 1547387400,
sys:{
type: 1,
id: 1267,
message: 0.0031,
country: "DE",
sunrise: 1547362817,
sunset: 1547394301
},
id: 2867714,
name: "Munich",
cod: 200
}, extendedData));
}

module.exports = generateWeather;

0 comments on commit b515b5f

Please sign in to comment.