Adjust month view to year view.

This commit is contained in:
2025-03-29 14:22:24 +01:00
parent 0319687d97
commit 5e2d693345
5 changed files with 47 additions and 19 deletions

View File

@@ -22,6 +22,17 @@ function build_date_dropdown(mysqli $db, string $table): array
return $dates;
}
function get_month(mysqli $db, string $table): array
{
$date_query = 'SELECT MIN(date) AS first, MAX(date) AS last FROM ' . $table . ';';
$date = $db->query($date_query)->fetch_assoc();
$first_date = new DateTime($date['first']);
$last_date = new DateTime($date['last']);
return ['first' => $first_date, 'last' => $last_date];
}
function get_years(mysqli $db, string $table): array
{
$years_query = 'SELECT MIN(YEAR(date)) AS first, MAX(YEAR(date)) AS last FROM ' . $table . ';';