Revised the JavaScript MonthTab class in the period chooser to avoid nested template literals, for readability.
This commit is contained in:
1 parent
f7efacad75
commit
8286c0c6d8
1 file changed
+2
-1
@@ -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);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user