Skip to content

fix: show unambiguous date for older "Last login" timestamps#1333

Open
ManojPawar2 wants to merge 1 commit into
RocketChat:developfrom
ManojPawar2:fix/last-login-ambiguous-date-1313
Open

fix: show unambiguous date for older "Last login" timestamps#1333
ManojPawar2 wants to merge 1 commit into
RocketChat:developfrom
ManojPawar2:fix/last-login-ambiguous-date-1313

Conversation

@ManojPawar2

Copy link
Copy Markdown

Overview

The Last login field in the User Information panel was ambiguous for any login that wasn't from today. formatTimestamp rendered non-today timestamps as just a weekday and time — e.g. Tuesday 10:49 PM — with no date. A login from 90 days ago looked identical to one from earlier this week, so there was no way to tell how old it actually was.

Fixes #1313

Root cause

packages/react/src/lib/formatTimestamp.js formatted non-today timestamps using only the weekday name:

return isDifferentDay
  ? `${date.toLocaleDateString('en-US', { weekday: 'long' })} ${formattedTime}`
  : formattedTime;

The weekday repeats every 7 days, so the output is ambiguous for anything older than a week. This is also inconsistent with the rest of the app, which already shows full dates (formatTimestampGetDate, and date-fns formatting in Message.js).

Fix

Render non-today timestamps with an explicit short month, day and year, while keeping today's logins as time-only:

return isDifferentDay
  ? `${date.toLocaleDateString('en-US', {
      month: 'short',
      day: 'numeric',
      year: 'numeric',
    })}, ${formattedTime}`
  : formattedTime;

Resulting output:

Timestamp | Before | After -- | -- | -- 90 days ago | Tuesday 10:49 PM | Mar 3, 2026, 10:49 PM A week ago | Wednesday 9:25 AM | Jun 18, 2026, 9:25 AM Today | 9:25 AM | 9:25 AM (unchanged)
  • Files changed: 1 — packages/react/src/lib/formatTimestamp.js

  • Scope: formatTimestamp is used only by the "Last login" field, so the change is fully contained and does not affect message timestamps or any other view.

Acceptance Criteria fulfillment

  • Non-today "Last login" values show an unambiguous date with year

  • Logins of different ages are now visually distinguishable

  • Today's logins still display only the time

  • Output style is consistent with date formatting used elsewhere in the app

How to test

  1. Open the User Information panel for a user whose last login is older than a few days.

  2. Confirm the Last login field shows a full date with year, e.g. Mar 3, 2026, 10:49 PM, instead of just a weekday.

  3. Open the panel for a user who logged in today and confirm it still shows only the time, e.g. 9:25 AM.

Video/Screenshots

N/A — text-only formatting change in the Last login field.

`formatTimestamp` rendered every non-today timestamp as just a weekday and
time (e.g. "Tuesday 10:49 PM"), so a login from 90 days ago looked identical
to one from earlier this week with no way to tell them apart.

Replace the weekday-only format with an explicit short month, day and year,
so older logins now read like "Mar 3, 2026, 10:49 PM". Today's logins keep
showing only the time. This also aligns the "Last login" field with how
dates are formatted elsewhere in the app (formatTimestampGetDate, Message.js).

Closes RocketChat#1313
Copilot AI review requested due to automatic review settings June 25, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

bug: "Last login" shows ambiguous weekday with no date for logins older than today

2 participants