aboutsummaryrefslogtreecommitdiff
path: root/routes/energy-usage.js
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2018-04-01 23:18:28 +0100
committerJames Barnett <noreply@jamesbarnett.xyz>2018-04-01 23:18:28 +0100
commit5fac63cf5fa974d9723617bc2bfa8f4e668fe342 (patch)
treec8d887f2bfa140ca1b7e00bb02a692ed62fe83ef /routes/energy-usage.js
parent567bea38fd7524e5e41fc5d09036cf86ad3932cd (diff)
downloadtplink-energy-monitor-5fac63cf5fa974d9723617bc2bfa8f4e668fe342.tar.xz
tplink-energy-monitor-5fac63cf5fa974d9723617bc2bfa8f4e668fe342.zip
Show total and average usage for current day and month
Diffstat (limited to 'routes/energy-usage.js')
-rw-r--r--routes/energy-usage.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/routes/energy-usage.js b/routes/energy-usage.js
index 740e29e..eb21eb9 100644
--- a/routes/energy-usage.js
+++ b/routes/energy-usage.js
@@ -130,9 +130,9 @@ function fillMissingMonths(sparseMonthStats, statsMoment) {
let denseMonthStats = [];
let maxMonths;
- // Dont fill months in months which havent happened yet
+ // Dont fill in months which exist in the future
if(statsMoment.year() === moment().year()) {
- maxMonths = moment().month();
+ maxMonths = moment().month() + 1; // API months are 1 based
}
else {
maxMonths = 12;