Standardize all output timestamps to ISO 8601#243
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR standardizes all CLI output timestamps to ISO 8601 format. Control API commands (apps, keys, integrations, channel rules) were using Changes
Review Notes
|
There was a problem hiding this comment.
Review Summary
This PR is a focused, clean consistency fix. The changes are correct and well-scoped.
What was checked
src/control-base-command.ts—formatDate()change fromtoLocaleString()totoISOString()- All 7 command files with JSON timestamp conversions
- Timestamp types in
src/services/control-api.ts(confirmedcreated/modifiedarenumber, not optional — no null-safety concern) buildPaginationNextinchannels/history.ts— correctly uses raw numeric timestamp before conversion;buildPaginationNextalready converts it to ISO internally- All remaining commands checked for un-converted timestamps in JSON paths — none found
One minor test observation
Several test files use the regex /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/ where the . between seconds and milliseconds is unescaped (should be \.). This will match any character in that position. It won't cause false positives in practice, but worth tightening if passing through this area again. The apps/list.test.ts change uses exact toBe() comparison which is strictly correct.
This doesn't warrant a change request.
Overall
The fix is correct. The formatDate() single-line change handles human-readable output for 12+ commands, and the per-command JSON path changes handle spread cases where raw epoch ms would have leaked through. No architectural concerns, no error handling gaps, no missed commands. Approved.
…tever the user wants to use)
8a49ee5 to
1d03a98
Compare
|
Seems,
|
Summary
toLocaleString()for timestamps, producing locale-dependent formats (e.g.,3/31/2026, 12:00:00 PMin the US,31/3/2026elsewhere). This was ambiguous — D/M/Y vs M/D/Y depends on the user's system locale. Now all human-readable timestamps use ISO 8601 (2022-01-01T00:00:00.000Z), matching what data-plane commands (channels, rooms, logs) already used.--jsonoutput by spreading SDK/API objects without converting timestamps. Other commands already converted to ISO strings, creating inconsistency. Now all JSON timestamp fields are ISO 8601 strings.--startand--endflags still accept ISO 8601, Unix milliseconds, and relative formats (1h,30m,2d).Why
Two formats in one CLI is confusing for users and breaks scripting assumptions. The D/M/Y vs M/D/Y ambiguity in
toLocaleString()meant the same command could produce different output on different machines. For JSON consumers, mixing epoch millis and ISO strings meant parsers had to handle both formats depending on which command they called.ISO 8601 is unambiguous, machine-parseable, and already what most of our commands used — this change makes the rest consistent.
What changed
Core fix —
ControlBaseCommand.formatDate()changed fromtoLocaleString()totoISOString(). This single-line change fixes human-readable output for 12+ commands.JSON output fixes — Added ISO conversion for timestamps leaking as epoch millis via object spreads in:
apps list,auth keys create/get/listchannels historyintegrations create/get/updateTests — Added ISO 8601 format assertions to 9 test files, and added missing
created/modifiedmock data where needed.Out of scope —
stats-display.tsintentionally shows local time alongside UTC in the live dashboard for wall-clock correlation. That's a different use case and left as-is.Test plan
pnpm preparebuilds successfullypnpm exec eslint .— 0 errorspnpm test:unit— 2197 passed, 0 failed🤖 Generated with Claude Code