Fix errors for first of month.
All checks were successful
Build power-consumtion image / Build-and-release-image (push) Successful in 1m19s

This commit is contained in:
2025-06-03 11:34:18 +02:00
parent 839c428ce6
commit 71d02abbd5

View File

@@ -42,12 +42,14 @@ $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->modify('-1 month')->format('Y-m') . "\")'><</button>"; echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->format('Y-m') . "\")'><</button>";
} else { } else {
echo '<span></span>'; echo '<span></span>';
} }
echo '<span style="text-align: center">' . $chosen_date_time->modify('+1 month')->format('Y-m') . '</span>'; $chosen_date_time->modify('+1 month');
echo '<span style="text-align: center">' . $chosen_date_time->format('Y-m') . '</span>';
if ($dates['last'] > $chosen_date_time->modify('+1 month')) { if ($dates['last'] > $chosen_date_time->modify('+1 month')) {
echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->format('Y-m') . "\")'>></button>"; echo "<button type='button' onclick='submit_form(\"" . $chosen_date_time->format('Y-m') . "\")'>></button>";
} else { } else {