'; } function active_path(string $path): string { $current = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH); return $current === $path ? 'is-active' : ''; } function selected(mixed $value, mixed $expected): string { return (string) $value === (string) $expected ? 'selected' : ''; } function checked(mixed $value): string { return (bool) $value ? 'checked' : ''; } function store_datetime(?string $value, string $format = 'M j, Y g:i A'): string { if ($value === null || $value === '') { return ''; } $date = new DateTimeImmutable($value, new DateTimeZone('UTC')); return $date->setTimezone(new DateTimeZone(date_default_timezone_get()))->format($format); } function utc_datetime(?string $value): ?string { if ($value === null || trim($value) === '') { return null; } $date = new DateTimeImmutable($value, new DateTimeZone(date_default_timezone_get())); return $date->setTimezone(new DateTimeZone('UTC'))->format('Y-m-d H:i:s'); }