@@ -226,7 +226,7 @@ const PacketMonitorPanel: React.FC<PacketMonitorPanelProps> = ({ onClose, onNode
226226 event . stopPropagation ( ) ; // Prevent row click
227227 // Set relay node to 0 if undefined/null (triggers "unknown relay" mode in modal)
228228 setSelectedRelayNode ( packet . relay_node ?? 0 ) ;
229- setSelectedRxTime ( new Date ( packet . timestamp * 1000 ) ) ;
229+ setSelectedRxTime ( new Date ( toMs ( packet . timestamp ) ) ) ;
230230 setSelectedMessageRssi ( packet . rssi ?? undefined ) ;
231231
232232 // Fetch direct neighbor stats (refresh to ensure up-to-date data)
@@ -295,38 +295,45 @@ const PacketMonitorPanel: React.FC<PacketMonitorPanelProps> = ({ onClose, onNode
295295 }
296296 } ;
297297
298- // Format timestamp — prepend short date for entries before today
299- const formatTimestamp = ( timestamp : number ) : string => {
300- const date = new Date ( timestamp * 1000 ) ;
301- const time = date . toLocaleTimeString ( 'en-US' , {
302- hour12 : timeFormat === '12' ,
303- hour : '2-digit' ,
304- minute : '2-digit' ,
305- second : '2-digit' ,
306- } ) ;
307- const ms = String ( date . getMilliseconds ( ) ) . padStart ( 3 , '0' ) ;
308- const timeStr = `${ time } .${ ms } ` ;
298+ // Convert timestamp to milliseconds (handles both old seconds and new ms data)
299+ const toMs = ( ts : number ) => ts < 10_000_000_000 ? ts * 1000 : ts ;
309300
301+ // Format date column — "Today" or short date
302+ const formatDateColumn = ( timestamp : number ) : string => {
303+ const date = new Date ( toMs ( timestamp ) ) ;
310304 const now = new Date ( ) ;
311305 const isToday = date . getFullYear ( ) === now . getFullYear ( ) &&
312306 date . getMonth ( ) === now . getMonth ( ) &&
313307 date . getDate ( ) === now . getDate ( ) ;
314308
315309 if ( isToday ) {
316- return timeStr ;
310+ return t ( 'packet_monitor.today' , 'Today' ) ;
317311 }
318312
319313 const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
320314 const day = String ( date . getDate ( ) ) . padStart ( 2 , '0' ) ;
321- let dateStr : string ;
322315 if ( dateFormat === 'DD/MM/YYYY' ) {
323- dateStr = `${ day } /${ month } ` ;
316+ return `${ day } /${ month } ` ;
324317 } else if ( dateFormat === 'YYYY-MM-DD' ) {
325- dateStr = `${ month } -${ day } ` ;
326- } else {
327- dateStr = `${ month } /${ day } ` ;
318+ return `${ month } -${ day } ` ;
328319 }
329- return `${ dateStr } ${ timeStr } ` ;
320+ return `${ month } /${ day } ` ;
321+ } ;
322+
323+ // Format time column — time with milliseconds
324+ const formatTimestamp = ( timestamp : number ) : string => {
325+ const date = new Date ( toMs ( timestamp ) ) ;
326+ const time = date . toLocaleTimeString ( 'en-US' , {
327+ hour12 : timeFormat === '12' ,
328+ hour : '2-digit' ,
329+ minute : '2-digit' ,
330+ second : '2-digit' ,
331+ } ) ;
332+ const ms = String ( date . getMilliseconds ( ) ) . padStart ( 3 , '0' ) ;
333+ // Insert ms before AM/PM if 12h format (e.g. "12:09:55 PM" → "12:09:55.979 PM")
334+ return timeFormat === '12'
335+ ? time . replace ( / ( \d { 2 } : \d { 2 } : \d { 2 } ) \s * ( A M | P M ) / i, `$1.${ ms } $2` )
336+ : `${ time } .${ ms } ` ;
330337 } ;
331338
332339 // Calculate hops
@@ -642,6 +649,7 @@ const PacketMonitorPanel: React.FC<PacketMonitorPanelProps> = ({ onClose, onNode
642649 < th style = { { width : '60px' } } > #</ th >
643650 < th style = { { width : '35px' } } > { t ( 'packet_monitor.column.dir' ) } </ th >
644651 < th style = { { width : '45px' } } > { t ( 'packet_monitor.column.via' ) } </ th >
652+ < th style = { { width : '55px' } } > { t ( 'packet_monitor.column.date' ) } </ th >
645653 < th style = { { width : '110px' } } > { t ( 'packet_monitor.column.time' ) } </ th >
646654 < th style = { { width : '140px' } } > { t ( 'packet_monitor.column.from' ) } </ th >
647655 < th style = { { width : '140px' } } > { t ( 'packet_monitor.column.to' ) } </ th >
@@ -743,10 +751,16 @@ const PacketMonitorPanel: React.FC<PacketMonitorPanelProps> = ({ onClose, onNode
743751 >
744752 { getTransportMechanismName ( packet . transport_mechanism ) . short }
745753 </ td >
754+ < td
755+ className = "date"
756+ style = { { width : '55px' } }
757+ >
758+ { formatDateColumn ( packet . timestamp ) }
759+ </ td >
746760 < td
747761 className = "timestamp"
748762 style = { { width : '110px' } }
749- title = { formatDateTime ( new Date ( packet . timestamp * 1000 ) , timeFormat , dateFormat ) }
763+ title = { formatDateTime ( new Date ( toMs ( packet . timestamp ) ) , timeFormat , dateFormat ) }
750764 >
751765 { formatTimestamp ( packet . timestamp ) }
752766 </ td >
0 commit comments