Fix errors for first of month.
Some checks failed
Build power-consumtion image / Build-and-release-image (push) Failing after 2m33s

This commit is contained in:
2025-04-01 08:27:25 +02:00
parent 4cb13ebc85
commit 23e4aaefa8
2 changed files with 3 additions and 2 deletions

View File

@@ -21,7 +21,8 @@ if (isset($_POST['action']) && $_POST['action'] == 'set_values') {
$actual = new DateTime(); $actual = new DateTime();
$dates = get_month($local_db, $table_aggregation); $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); $data = get_aggregation($local_db, $table_aggregation, $chosen_date);
$month_values = get_month_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); $year_values = get_year_aggregation($local_db, $table_aggregation, $chosen_date);

View File

@@ -32,7 +32,7 @@ if (isset($_POST['action']) && $_POST['action'] == 'set_values') {
$actual = new DateTime(); $actual = new DateTime();
$dates = get_month($local_db, $table_aggregation); $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); $production_values = get_production_values_for_month($local_db, $table_aggregation, $chosen_date);
$month_production = get_month_production($local_db, $table_production, $chosen_date); $month_production = get_month_production($local_db, $table_production, $chosen_date);