From 243e5a93fca7f9e77b9f2ddf5c03f8aca51b435b Mon Sep 17 00:00:00 2001 From: Neldin Date: Wed, 29 Jan 2020 16:27:43 +0100 Subject: [PATCH 1/2] Fix event end date being incorrect --- widget/controllers/widget.event.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/controllers/widget.event.controller.js b/widget/controllers/widget.event.controller.js index 1e27fc9..e8151e5 100644 --- a/widget/controllers/widget.event.controller.js +++ b/widget/controllers/widget.event.controller.js @@ -146,11 +146,11 @@ /*Add to calendar event will add here*/ var eventStartDate = new Date(event.data.startDate); var eventEndDate; - if (event.data.endDate !== '' && event.data.endDate < event.data.startDate) { + if (event.data.endDate !== '' && event.data.endDate > event.data.startDate) { eventEndDate = new Date(event.data.endDate); } else { - eventEndDate = new Date(event.data.startDate + 3600); //add hour to start date to derive end date + eventEndDate = new Date(event.data.startDate + 3600000); //add hour to start date to derive end date } if (WidgetEvent.getAddedEventToLocalStorage(event.id) != -1) { alert("Event already added in calendar"); From c39e7736d5e70e597e9e5e22eb59de579d73afed Mon Sep 17 00:00:00 2001 From: Neldin Date: Wed, 29 Jan 2020 17:32:30 +0100 Subject: [PATCH 2/2] Fix accented characters displaying wrong. --- widget/controllers/widget.event.controller.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/widget/controllers/widget.event.controller.js b/widget/controllers/widget.event.controller.js index e8151e5..7cdd3aa 100644 --- a/widget/controllers/widget.event.controller.js +++ b/widget/controllers/widget.event.controller.js @@ -171,6 +171,7 @@ } if (event.data.description) { eventDescr = event.data.description.replace(/<[^>]*>?/g, ''); //dépouiller les caractères spéciaux + eventDescr = decodeHtmlCharCodes(eventDescr); } else { eventDescr = ""; } @@ -188,6 +189,13 @@ } } } + + function decodeHtmlCharCodes(str) { + return str.replace(/(&#(\d+);)/g, function(match, capture, charCode) { + return String.fromCharCode(charCode); + }); + }; + buildfire.device.calendar.addEvent( { title: eventTitle