Skip to content

Replace moment with built-in Intl date formatting - #69

Merged
ashirman merged 3 commits into
mainfrom
feature/rev-135-moment
Oct 15, 2026
Merged

ashirman merged 3 commits into
mainfrom
feature/rev-135-moment

Conversation

@revopushbot

@revopushbot revopushbot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of REV-135 (dependency cleanup, step 4). Removes moment, which took 5.4 MB in node_modules, mostly 139 locale files the CLI never loads, and which its maintainers call a legacy project.

The CLI doesn't promise an exact date wording, so this uses Node's built-in Intl formatters rather than copying moment's rules. Dates are worded slightly differently; see the table below.

Changes

  • Table dates (access-key ls, session ls, deployment ls, deployment history): formatDate in command-executor.ts uses Intl.RelativeTimeFormat within 30 days and toLocaleDateString for older dates.
  • access-key patch expiry date: toLocaleString with dateStyle: "full" and timeStyle: "short".
  • debug log timestamps: toLocaleTimeString with a 24-hour clock.
  • Locale: every formatter is pinned to en-US, so output stays English on any machine.
  • moment is removed from dependencies. The two tests that check the expiry message now expect "at".

Output before and after

Case Before (moment) After (Intl)
10 seconds ago a few seconds ago 10 seconds ago
50 minutes ago an hour ago 50 minutes ago
2 hours ago 2 hours ago 2 hours ago
30 hours ago a day ago yesterday
26 days ago a month ago 26 days ago
in 20 days in 20 days in 20 days
45 days ago / an earlier year Aug 31 / Nov 6, 2014 same
Missing date (e.g. a session without a login time) "a few seconds ago" empty cell
access-key patch expiry Thursday, December 3, 2026 2:05 PM Thursday, December 3, 2026 at 2:05 PM
debug timestamps 02:05:09 (12-hour, no AM/PM) 14:05:09 (24-hour)

Verification

  • Build, lint and format check: tsc, npm run lint and npm run format:check are clean.
  • Tests: all 158 pass on macOS and on Linux (Docker, Node 20.19.0).
  • Output: each "After" value in the table above comes from running the built code.

🤖 Generated with Claude Code

revopushbot and others added 3 commits October 15, 2026 16:27
The CLI used moment for table dates, the access key expiry date and debug
log timestamps. date-utils reproduces moment 2.31.0's English output
exactly, including its relative-time cutoffs, its daylight saving aware day
count, and "Invalid date" for missing or invalid times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exact moment wording is not part of the CLI's contract, so the built-in
Intl formatters replace the date-utils helper. Relative times use exact
numbers ("50 minutes ago", "yesterday"), the expiry date reads "… at 2:05 PM"
and debug timestamps use a 24-hour clock. A missing date shows as an empty
cell instead of crashing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@revopushbot revopushbot changed the title Replace moment with a small date helper Replace moment with built-in Intl date formatting Oct 15, 2026
@ashirman
ashirman merged commit aa2719e into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants