From 23e4aaefa8d8461b94f7e6f57070e593dbb723a9 Mon Sep 17 00:00:00 2001 From: Christian Steinle Date: Tue, 1 Apr 2025 08:27:25 +0200 Subject: [PATCH] Fix errors for first of month. --- public/index.php | 3 ++- public/production.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index cb8f10b..90b65d5 100644 --- a/public/index.php +++ b/public/index.php @@ -21,7 +21,8 @@ if (isset($_POST['action']) && $_POST['action'] == 'set_values') { $actual = new DateTime(); $dates = get_month($local_db, $table_aggregation); -$chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $actual->format('Y-m'); +$chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $actual->modify('-1 day')->format('Y-m'); + $data = get_aggregation($local_db, $table_aggregation, $chosen_date); $month_values = get_month_aggregation($local_db, $table_aggregation, $chosen_date); $year_values = get_year_aggregation($local_db, $table_aggregation, $chosen_date); diff --git a/public/production.php b/public/production.php index 3f5c154..ccd2832 100644 --- a/public/production.php +++ b/public/production.php @@ -32,7 +32,7 @@ if (isset($_POST['action']) && $_POST['action'] == 'set_values') { $actual = new DateTime(); $dates = get_month($local_db, $table_aggregation); -$chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $actual->format('Y-m'); +$chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $actual->modify('-1 day')->format('Y-m'); $production_values = get_production_values_for_month($local_db, $table_aggregation, $chosen_date); $month_production = get_month_production($local_db, $table_production, $chosen_date);