of both create.php and // edit.php. Expects: // $data : associative array with every events column (see events_defaults()) // $item : the existing row on edit (for the current hero preview), or null $item = $item ?? null; // datetime-local inputs want "YYYY-MM-DDTHH:MM"; DB gives "YYYY-MM-DD HH:MM:SS". $dt = static function ($v): string { $v = trim((string) $v); if ($v === '' || $v === '0000-00-00 00:00:00') return ''; return substr(str_replace(' ', 'T', $v), 0, 16); }; ?>