MCPcopy Create free account
hub / github.com/ShipSecAI/studio / formatDuration

Function formatDuration

frontend/src/components/timeline/EventInspector.tsx:312–326  ·  view source on GitHub ↗
(start: string, end?: string)

Source from the content-addressed store, hash-verified

310 };
311
312 const formatDuration = (start: string, end?: string): string => {
313 const startTime = new Date(start).getTime();
314 const endTime = end ? new Date(end).getTime() : Date.now();
315 const duration = Math.max(0, endTime - startTime);
316
317 if (duration < 1000) {
318 return `${duration}ms`;
319 } else if (duration < 60000) {
320 return `${(duration / 1000).toFixed(2)}s`;
321 } else {
322 const minutes = Math.floor(duration / 60000);
323 const seconds = ((duration % 60000) / 1000).toFixed(1);
324 return `${minutes}m ${seconds}s`;
325 }
326 };
327
328 const formatData = (data: Record<string, unknown>) => {
329 try {

Callers 1

EventInspectorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected