Adjust month view to year view.
This commit is contained in:
@@ -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 . ';';
|
||||
|
||||
Reference in New Issue
Block a user