From 93e5a77e04cd944024f5120b70c948fa8597b251 Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 28 Oct 2023 10:49:43 -0600 Subject: [PATCH] auto-compute TODAY-6 months --- cmd/http/public/explore.html | 10 ++++++++-- cmd/http/public/index.html | 17 ++++++++++++++--- cmd/http/public/transactions.html | 9 ++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/cmd/http/public/explore.html b/cmd/http/public/explore.html index 74bf6c8..b7c115e 100644 --- a/cmd/http/public/explore.html +++ b/cmd/http/public/explore.html @@ -29,9 +29,15 @@ console.log(path, query); document.getElementById("graph").src = window.origin + path + query } + function init() { + const zeroPad = (num, places) => String(num).padStart(places, '0') + var d = new Date() + d.setMonth(d.getMonth()-6) + document.getElementsByName("zoomStart")[0].value = `${d.getFullYear()}-${zeroPad(d.getMonth(), 2)}` + } - +
@@ -61,7 +67,7 @@ - + diff --git a/cmd/http/public/index.html b/cmd/http/public/index.html index d70545e..1684864 100644 --- a/cmd/http/public/index.html +++ b/cmd/http/public/index.html @@ -1,14 +1,25 @@
+
- +

Moolah2 Hub

diff --git a/cmd/http/public/transactions.html b/cmd/http/public/transactions.html index 88e3ad0..8911ea5 100644 --- a/cmd/http/public/transactions.html +++ b/cmd/http/public/transactions.html @@ -23,6 +23,13 @@ } f = "." + f function init() { + const zeroPad = (num, places) => String(num).padStart(places, '0') + var d = new Date() + d.setMonth(d.getMonth()-6) + const replacement = `${d.getFullYear()}-${zeroPad(d.getMonth(), 2)}` + var iframe = document.getElementsByTagName("iframe")[0] + iframe.src = iframe.src.replace("YYYY-MM", replacement) + load(f) } function load(f) { @@ -71,7 +78,7 @@
Look at this graph - +