From 8cd4a84a01df68bee8d5614a39abb115571a4177 Mon Sep 17 00:00:00 2001
From: Recolic <git@me.recolic.net>
Date: Tue, 4 Mar 2025 14:03:33 -0800
Subject: [PATCH] .dummy adjustment, timezone fix

---
 api.php    | 2 +-
 index.html | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/api.php b/api.php
index 715ea97..1adeaef 100644
--- a/api.php
+++ b/api.php
@@ -179,7 +179,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     // Handle render page request
     $results = renderPage();
     foreach ($results as $date) {
-        echo "Budget used on: $date\n";
+        echo "X:$date\n";
     }
 } else {
     echo "Invalid request method\n";
diff --git a/index.html b/index.html
index afd7f84..02face2 100644
--- a/index.html
+++ b/index.html
@@ -53,7 +53,13 @@
 
     <script src="calendarorganizer.js"></script>
     <script>
-        const date_today = new Date().toISOString().split('T')[0]; // YYYY-mm-dd
+        function getLocalDateString() {
+            // Returns YYYY-mm-dd
+            // Simply `new Date().toISOString().split('T')[0]` doesn't work, because toISOString is in UTC.
+            const d = new Date();
+            return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
+        }
+        const date_today = getLocalDateString();
 
         // document.getElementById('submit-form').addEventListener('submit', 
         function submitNewCostForm() {
-- 
GitLab