diff --git a/MoneyMap/Pages/Transactions.cshtml b/MoneyMap/Pages/Transactions.cshtml index 90856f1..1e58b40 100644 --- a/MoneyMap/Pages/Transactions.cshtml +++ b/MoneyMap/Pages/Transactions.cshtml @@ -49,11 +49,21 @@
- +
- + +
+
+
+ + + + + + +
@@ -302,5 +312,40 @@ else var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl) }) + + // Quick date range functions + function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; + } + + function setDateRange(days) { + const endDate = new Date(); + const startDate = new Date(); + startDate.setDate(startDate.getDate() - days); + + document.getElementById('startDateInput').value = formatDate(startDate); + document.getElementById('endDateInput').value = formatDate(endDate); + } + + function setDateRangeThisMonth() { + const now = new Date(); + const startDate = new Date(now.getFullYear(), now.getMonth(), 1); + const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0); + + document.getElementById('startDateInput').value = formatDate(startDate); + document.getElementById('endDateInput').value = formatDate(endDate); + } + + function setDateRangeLastMonth() { + const now = new Date(); + const startDate = new Date(now.getFullYear(), now.getMonth() - 1, 1); + const endDate = new Date(now.getFullYear(), now.getMonth(), 0); + + document.getElementById('startDateInput').value = formatDate(startDate); + document.getElementById('endDateInput').value = formatDate(endDate); + } } \ No newline at end of file