broadcastEvents errors out - now is not defined
Closed this issue · 2 comments
btoconnor commented
When setting broadcastEvents
to be true
, the MMM-GoogleCalendar
module throws an error:
MMM-GoogleCalendar.js:1087 Uncaught (in promise) ReferenceError: now is not defined
at Class.broadcastEvents (MMM-GoogleCalendar.js:1087:90)
at Class.socketNotificationReceived (MMM-GoogleCalendar.js:152:16)
at module.js:235:9
at Socket.<anonymous> (socketclient.js:38:4)
at Emitter.emit (index.mjs:136:20)
at Socket.emitEvent (socket.js:498:20)
at Socket.onevent (socket.js:485:18)
at MMSocket.socket.onevent (socketclient.js:32:11)
at Socket.onpacket (socket.js:455:22)
at Emitter.emit (index.mjs:136:20)
This can be fixed with the following diff:
diff --git a/MMM-GoogleCalendar.js b/MMM-GoogleCalendar.js
index ecb7690..6c9bc4a 100644
--- a/MMM-GoogleCalendar.js
+++ b/MMM-GoogleCalendar.js
@@ -1065,6 +1065,8 @@ Module.register("MMM-GoogleCalendar", {
* The all events available in one array, sorted on startDate.
*/
broadcastEvents: function () {
+ const now = new Date();
+
const eventList = [];
for (const calendarID in this.calendarData) {
for (const ev of this.calendarData[calendarID]) {
If you need me to open a PR for this, please let me know.
randomBrainstormer commented
Hi @btoconnor, Thank you for identifying the issue and proposing a solution! Please feel free to open a PR for this. Thanks!
randomBrainstormer commented
Hi, I've added a small commit to address the diff. Thank you for your contributing to the project!