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

This commit is contained in:
2025-06-03 11:47:32 +02:00
parent 71d02abbd5
commit 81629ebfeb

View File

@@ -42,10 +42,10 @@ $chosen_date_time = new DateTime($chosen_date);
<body> <body>
<form id="date_form" style="align-self: center; width: 500px; display: grid; grid-template-columns: 20% 20% 20% 20% 20%; gap: 10px;" action="/index.php" method="post"> <form id="date_form" style="align-self: center; width: 500px; display: grid; grid-template-columns: 20% 20% 20% 20% 20%; gap: 10px;" action="/index.php" method="post">
<?php <?php
$chosen_date_time->modify('-1 month');
if ($dates['first'] < $chosen_date_time) { if ($dates['first'] < $chosen_date_time) {
echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->format('Y-m') . "\")'><</button>"; echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->modify('-1 month')->format('Y-m') . "\")'><</button>";
} else { } else {
$chosen_date_time->modify('-1 month');
echo '<span></span>'; echo '<span></span>';
} }
$chosen_date_time->modify('+1 month'); $chosen_date_time->modify('+1 month');