From: ebelcrom Date: Fri, 6 Mar 2020 17:43:32 +0000 (+0100) Subject: timestamp in notification message added X-Git-Tag: v1.0.0~2 X-Git-Url: http://www.binomiant.duckdns.org/9wAuyR5S/?a=commitdiff_plain;h=370a7d89c58812ac6d59db84c7c66bb8a977c6d8;p=garnod.git timestamp in notification message added --- diff --git a/lib/notify.js b/lib/notify.js index 0a28a87..9015e8a 100644 --- a/lib/notify.js +++ b/lib/notify.js @@ -4,6 +4,7 @@ const gpio = require('./gpio'); const settings = require('./../init/settings.json'); const fs = require('fs'); const webpush = require('web-push'); +const dateformat = require('dateformat'); var data = { area: null, @@ -67,8 +68,10 @@ function executeNotification(notification) { const icon = 'data:image/png;base64,' + fs.readFileSync(__dirname + '/../public/images/icon.png', 'base64'); + const now = new Date(); + const timestamp = dateformat(now, 'ddd mmm dd yyyy HH:MM:ss Z'); const payload = { - message: 'The garage door is open!', + message: 'The garage door is open!\n' + timestamp, icon: icon }; log.debug('Paylod length:', JSON.stringify(payload).length);