| | |
| | | } |
| | | |
| | | /** |
| | | * Convert MySQL datetime to ISO 8601 timestamp with proper timezone |
| | | */ |
| | | protected function formatTimestamp(?string $mysql_datetime): ?string |
| | | { |
| | | if (empty($mysql_datetime)) { |
| | | return null; |
| | | } |
| | | |
| | | try { |
| | | // Get WordPress timezone - dates are stored in this timezone |
| | | $wp_timezone = wp_timezone(); |
| | | |
| | | // Parse the datetime in WordPress timezone |
| | | $date = new DateTime($mysql_datetime, $wp_timezone); |
| | | |
| | | // Convert to UTC for API consistency |
| | | $date->setTimezone(new DateTimeZone('UTC')); |
| | | |
| | | // Return ISO 8601 format |
| | | return $date->format('c'); |
| | | |
| | | } catch (Exception $e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get human-readable operation title |
| | | */ |
| | | protected function getOperationTitle(string $type, array $data): string |