summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-nlbwmon
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-02-01 13:54:32 -0500
committerJo-Philipp Wich <jo@mein.io>2019-02-15 11:57:28 +0100
commitbd56c1aac650c9d60d9f66bb0c923b0346f3fa41 (patch)
tree559a35f564a9f1c5fe275a38ed5dab09bf7f03c0 /applications/luci-app-nlbwmon
parenteda8f02dac3caa4d0f52cd1e860d7a392c295df3 (diff)
luci-app-nlbwmon: Fixed incorrect period parameter/display
Switch from using the unreliable string data constructor syntax to a more explicit year / month / day variant and pass through the period value as-is in order to ensure that the proper start date is requested from the backend. This should fix issues with prevent the display of older data periods in the nlbwmon gui. Ref: https://github.com/jow-/nlbwmon/issues/25 Ref: https://github.com/openwrt/luci/pull/2496 Suggested-by: Aktanusa <chanam.geo@yahoo.com> [squashed commits, add a more thorough commit message] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-nlbwmon')
-rw-r--r--applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw.js b/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw.js
index e5ae69b3a..8a01b1db4 100644
--- a/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw.js
+++ b/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw.js
@@ -226,13 +226,15 @@ function renderPeriods()
var sel = document.getElementById('nlbw.period');
for (var e, i = trafficPeriods.length - 1; e = trafficPeriods[i]; i--) {
- var d1 = new Date(e);
- var d2, pd;
+ var ymd1 = e.split(/-/);
+ var d1 = new Date(+ymd1[0], +ymd1[1] - 1, +ymd1[2]);
+ var ymd2, d2, pd;
if (i) {
- d2 = new Date(trafficPeriods[i - 1]);
+ ymd2 = trafficPeriods[i - 1].split(/-/);
+ d2 = new Date(+ymd2[0], +ymd2[1] - 1, +ymd2[2]);
d2.setDate(d2.getDate() - 1);
- pd = '%04d-%02d-%02d'.format(d1.getFullYear(), d1.getMonth() + 1, d1.getDate());
+ pd = e;
}
else {
d2 = new Date();