@@ -402,9 +402,16 @@ export default defineComponent({
402402 const allBytes = computed (() => byteArray .value );
403403
404404 // Helper function to format timestamp
405- const formatTimestamp = (timestampMs : number ): string => {
405+ const formatTimestamp = (timestampMs : number , includeMilliseconds : boolean = false ): string => {
406406 const date = new Date (timestampMs );
407- return date .toISOString ().replace (' T' , ' ' ).replace (/ \. \d {3} Z$ / , ' UTC' );
407+ const isoString = date .toISOString ();
408+ if (includeMilliseconds ) {
409+ // Keep milliseconds: "2025-10-03T17:35:00.123Z" -> "2025-10-03 17:35:00.123 UTC"
410+ return isoString .replace (' T' , ' ' ).replace (' Z' , ' UTC' );
411+ } else {
412+ // Remove milliseconds: "2025-10-03T17:35:00.123Z" -> "2025-10-03 17:35:00 UTC"
413+ return isoString .replace (' T' , ' ' ).replace (/ \. \d {3} Z$ / , ' UTC' );
414+ }
408415 };
409416
410417 // Helper function to apply conversion to a value
@@ -431,14 +438,16 @@ export default defineComponent({
431438 if (! isNaN (timestampValue )) {
432439 // Check if the timestamp is in seconds or milliseconds based on the unit
433440 // If unit contains "s since epoch" (not "ms since epoch"), it's in seconds
434- const isSeconds = unit && unit .includes (' s since epoch' ) && ! unit .includes (' ms since epoch' );
441+ const isSeconds = !! unit && unit .includes (' s since epoch' ) && ! unit .includes (' ms since epoch' );
442+ const isMilliseconds = !! unit && unit .includes (' ms since epoch' );
435443
436444 if (isSeconds ) {
437445 // Convert seconds to milliseconds for formatTimestamp
438446 timestampValue = timestampValue * 1000 ;
439447 }
440448
441- const result = formatTimestamp (timestampValue );
449+ // Include milliseconds in output if the unit explicitly indicates millisecond precision
450+ const result = formatTimestamp (timestampValue , isMilliseconds );
442451 return result ;
443452 }
444453 }
0 commit comments