diff --git a/admin/class-twp-admin.php b/admin/class-twp-admin.php
index 762dc6e..fd15dda 100644
--- a/admin/class-twp-admin.php
+++ b/admin/class-twp-admin.php
@@ -32,6 +32,27 @@ class TWP_Admin {
return false;
}
+ /**
+ * Format timestamp with WordPress timezone
+ *
+ * @param string $timestamp Database timestamp (assumed to be in UTC)
+ * @param string $format Date format string
+ * @return string Formatted date in WordPress timezone
+ */
+ private function format_timestamp_with_timezone($timestamp, $format = 'M j, Y g:i A') {
+ // Get WordPress timezone
+ $timezone = wp_timezone();
+
+ // Create DateTime object from the UTC timestamp
+ $date = new DateTime($timestamp, new DateTimeZone('UTC'));
+
+ // Convert to WordPress timezone
+ $date->setTimezone($timezone);
+
+ // Return formatted date
+ return $date->format($format);
+ }
+
/**
* Register admin menu
*/
@@ -2527,7 +2548,7 @@ class TWP_Admin {
foreach ($recent_calls as $call) {
?>
- created_at))); ?> |
+ format_timestamp_with_timezone($call->created_at)); ?> |
from_number ?: 'N/A'); ?> |
to_number ?: 'N/A'); ?> |
agent_name ?: 'N/A'); ?> |
@@ -2651,7 +2672,7 @@ class TWP_Admin {
foreach ($voicemails as $voicemail) {
?>
- created_at))); ?> |
+ format_timestamp_with_timezone($voicemail->created_at)); ?> |
from_number); ?> |
workflow_name ?: 'N/A'); ?> |
duration ? esc_html($voicemail->duration . 's') : 'Unknown'; ?> |
@@ -2704,7 +2725,7 @@ class TWP_Admin {
foreach ($logs as $log) {
?>
- created_at))); ?> |
+ format_timestamp_with_timezone($log->created_at)); ?> |
from_number ?: 'Unknown'); ?> |
to_number ?: 'System'); ?> |
@@ -3391,9 +3412,9 @@ class TWP_Admin {
}
if ($log_table_exists) {
- // Get recent calls from last 24 hours
+ // Get recent calls from last 24 hours with phone numbers
$recent_calls = $wpdb->get_results(
- "SELECT call_sid, status, duration, updated_at
+ "SELECT call_sid, from_number, to_number, status, duration, updated_at
FROM $log_table
WHERE updated_at >= DATE_SUB(NOW(), INTERVAL 24 HOUR)
ORDER BY updated_at DESC
@@ -3407,10 +3428,14 @@ class TWP_Admin {
$formatted_calls = array();
foreach ($recent_calls as $call) {
+ // Format phone numbers for display
+ $from_display = $call->from_number ?: 'Unknown';
+ $to_display = $call->to_number ?: 'Unknown';
+
$formatted_calls[] = array(
- 'time' => date('H:i', strtotime($call->updated_at)),
- 'from' => substr($call->call_sid, 0, 10) . '...',
- 'to' => 'System',
+ 'time' => $this->format_timestamp_with_timezone($call->updated_at, 'H:i'),
+ 'from' => $from_display,
+ 'to' => $to_display,
'status' => ucfirst($call->status),
'duration' => $call->duration ? $call->duration . 's' : '-'
);
@@ -4720,7 +4745,7 @@ class TWP_Admin {
Received on
|
- last_message_time))); ?>
+ format_timestamp_with_timezone($conversation->last_message_time, 'M j, H:i')); ?>
last_message_direction === 'incoming' ? '← Received' : '→ Sent'; ?>
|