From 8286c0c6d8759effc13a53dd70aeeeffbfb32124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 3 Apr 2023 21:19:48 +0800 Subject: [PATCH] Revised the JavaScript MonthTab class in the period chooser to avoid nested template literals, for readability. --- src/accounting/static/js/period-chooser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/accounting/static/js/period-chooser.js b/src/accounting/static/js/period-chooser.js index 0bdfcce..4224819 100644 --- a/src/accounting/static/js/period-chooser.js +++ b/src/accounting/static/js/period-chooser.js @@ -181,7 +181,8 @@ class MonthTab extends TabPlane { }); monthChooser.addEventListener(tempusDominus.Namespace.events.change, (e) => { const date = e.detail.date; - const period = `${date.year}-${`0${date.month + 1}`.slice(-2)}`; + const zeroPaddedMonth = `0${date.month + 1}`.slice(-2) + const period = `${date.year}-${zeroPaddedMonth}`; window.location = chooser.modal.dataset.urlTemplate .replaceAll("PERIOD", period); });