π Analysis: Time Format Handling in the Codebase
Here's what I found:
1. Input Parsing: Multiple Formats β Milliseconds
Location: parseTime() in data-layer.js (and duplicate in main-legacy.js)
Handles:
"1.5s" β 1500ms
"500ms" β 500ms
"100Β΅s" β 0.1ms
"250ns" β 0.000250ms
Status: β
STANDARDIZED - Single function in data-layer.js
2. Output Formatting: Milliseconds β Display Format
Location: Formatters.formatTime() in main-legacy-cleaned.js (line 563)
Converts:
- Milliseconds β
"MM:SS.mmm" format
1500ms β "00:01.500"
65000ms β "01:05.000"
0ms β "00:00.000"
Status: β NOT IN MODULES - Still in main-legacy-cleaned.js
3. Tooltip Formatting
Location: Formatters.formatTimeTooltip() in main-legacy-cleaned.js (line 590)
Purpose: Shows original time string for precision
- Small values: Shows
"Original: 146.266Β΅s"
- Shows original if different from formatted
Status: β NOT IN MODULES
4. Chart Display Formats
Location: ChartTimeUtils / Chart.js config in main-legacy-cleaned.js
Formats:
"HH:mm:ss.SSS" for milliseconds
"HH:mm:ss" for seconds
"MMM dd HH:mm" for minutes/hours
"MMM dd" for days
Status: β
IN CHARTS.JS (ChartTimeUtils)
5. Table/UI Display
Location: Scattered throughout tables.js, parsers.js, main-legacy-cleaned.js
Uses:
.toISOString().replace('T', ' ').substring(0, 23) + 'Z' for timestamps
.toFixed(2) for durations in seconds
formatTime() for consistent MM:SS.mmm display
Status: β οΈ INCONSISTENT - Multiple patterns
π Summary
β
Standardized (Good):
- parseTime() - Single function in data-layer.js converts all formats to ms
- parseCouchbaseDateTime() - Single function for CB datetime parsing
β Not Standardized (Needs Work):
- Formatters.formatTime() - Still in main-legacy, should be in ui-helpers.js
- Formatters.formatTimeTooltip() - Still in main-legacy
- Timestamp display - Multiple patterns (
.toISOString(), .substring(0, 23), etc.)
π‘ Recommendation:
Move to ui-helpers.js:
export function formatTime(milliseconds) { ... } // MM:SS.mmm
export function formatTimeTooltip(timeStr, ms) { ... }
export function formatTimestamp(date) { ... } // Standardize timestamp display
This would centralize ALL time formatting in one place (ui-helpers.js for display, data-layer.js for parsing).
π Analysis: Time Format Handling in the Codebase
Here's what I found:
1. Input Parsing: Multiple Formats β Milliseconds
Location:
parseTime()in data-layer.js (and duplicate in main-legacy.js)Handles:
"1.5s"β 1500ms"500ms"β 500ms"100Β΅s"β 0.1ms"250ns"β 0.000250msStatus: β STANDARDIZED - Single function in data-layer.js
2. Output Formatting: Milliseconds β Display Format
Location:
Formatters.formatTime()in main-legacy-cleaned.js (line 563)Converts:
"MM:SS.mmm"format1500msβ"00:01.500"65000msβ"01:05.000"0msβ"00:00.000"Status: β NOT IN MODULES - Still in main-legacy-cleaned.js
3. Tooltip Formatting
Location:
Formatters.formatTimeTooltip()in main-legacy-cleaned.js (line 590)Purpose: Shows original time string for precision
"Original: 146.266Β΅s"Status: β NOT IN MODULES
4. Chart Display Formats
Location: ChartTimeUtils / Chart.js config in main-legacy-cleaned.js
Formats:
"HH:mm:ss.SSS"for milliseconds"HH:mm:ss"for seconds"MMM dd HH:mm"for minutes/hours"MMM dd"for daysStatus: β IN CHARTS.JS (ChartTimeUtils)
5. Table/UI Display
Location: Scattered throughout tables.js, parsers.js, main-legacy-cleaned.js
Uses:
.toISOString().replace('T', ' ').substring(0, 23) + 'Z'for timestamps.toFixed(2)for durations in secondsformatTime()for consistent MM:SS.mmm displayStatus:β οΈ INCONSISTENT - Multiple patterns
π Summary
β Standardized (Good):
β Not Standardized (Needs Work):
.toISOString(),.substring(0, 23), etc.)π‘ Recommendation:
Move to ui-helpers.js:
This would centralize ALL time formatting in one place (ui-helpers.js for display, data-layer.js for parsing).