fix: show full date in formatTimestamp for non-today timestamps#1314
Open
yash113gadia wants to merge 1 commit into
Open
fix: show full date in formatTimestamp for non-today timestamps#1314yash113gadia wants to merge 1 commit into
yash113gadia wants to merge 1 commit into
Conversation
formatTimestamp rendered any timestamp that wasn't from the current day as a bare weekday + time (e.g. "Tuesday 10:49 PM"). This made the "Last login" field in the User Information panel ambiguous: a login from months — or even over a year — ago was indistinguishable from a recent one, and no year was ever shown. Now non-today timestamps include a full date with year (e.g. "Mar 3, 2026, 10:49 PM"), consistent with how createdAt (formatTimestampGetDate) and message dates (date-fns) are already shown. Same-day timestamps still render as time-only. Closes RocketChat#1313
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Show a full date for non-today timestamps in
formatTimestampAcceptance Criteria fulfillment
createdAtfield and message datesFixes #1313
Description
formatTimestamp(packages/react/src/lib/formatTimestamp.js) rendered any timestamp not from the current day as just a weekday + time:Since
isDifferentDayonly means "not today", every past timestamp collapsed to a bare weekday. In the Last login field of the User Information panel this is ambiguous — a login from months (or over a year) ago is indistinguishable from a recent one, and no year is ever shown.The fix returns time-only for same-day timestamps (unchanged) and a full date with year otherwise.
Before / After
Tuesday 10:49 PMMar 3, 2026, 10:49 PMSunday 10:49 PMApr 27, 2025, 10:49 PM10:49 PM10:49 PMThis matches how the adjacent created at field (
formatTimestampGetDate) and message dates (date-fns) are already formatted.PR Test Details
Open a User Information panel for a user whose last login was on a previous day → Last login now shows a dated, unambiguous value instead of a bare weekday.
eslintpasses clean on the changed file.