Skip to content

chore(omnichannel): remove moment dependency from ChatInfo#38686

Closed
sezallagwal wants to merge 1 commit intoRocketChat:developfrom
sezallagwal:fix/remove-moment-from-chatinfo
Closed

chore(omnichannel): remove moment dependency from ChatInfo#38686
sezallagwal wants to merge 1 commit intoRocketChat:developfrom
sezallagwal:fix/remove-moment-from-chatinfo

Conversation

@sezallagwal
Copy link
Copy Markdown
Contributor

@sezallagwal sezallagwal commented Feb 14, 2026

Description

Removes moment from ChatInfo.tsx in favor of the existing formatDuration hook and native Date arithmetic, keeping the codebase consistent with the project's own formatting utilities.

Changes

  • Removed import moment from 'moment'
  • Removed the associated TODO comment
  • Replaced moment(closedAt).from(moment(ts), true) with formatDuration + native Date for Chat Duration
  • Replaced moment(responseBy.lastMessageTs).fromNow(true) with formatDuration + native Date for Inactivity Time
  • Added missing ts nullability guard on the Chat Duration conditional

Summary by CodeRabbit

  • Refactor
    • Updated date and time formatting logic in chat information display to use consistent project-specific formatting utilities, improving code maintainability while preserving the same user-facing behavior.

@sezallagwal sezallagwal requested a review from a team as a code owner February 14, 2026 14:38
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Feb 14, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR has conflicts, please resolve them before merging
  • This PR is missing the 'stat: QA assured' label
  • This PR is not mergeable
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 14, 2026

⚠️ No Changeset found

Latest commit: 8586545

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 14, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

Walkthrough

A refactoring that replaces moment.js-based date-time formatting with project-specific formatting hooks (useFormatDateAndTime and useFormatDuration) in a chat info component. Conditional rendering guards ensure duration fields only render when necessary data is available.

Changes

Cohort / File(s) Summary
Date Formatter Refactoring
apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/ChatInfo.tsx
Removes moment.js usage and replaces with custom formatting hooks. Adds ts guards for conditional duration rendering. Substitutes moment relative date calculations with explicit duration calculations in seconds.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hop, hop! No more moment delays,
Custom hooks light up our ways,
Duration dances without the strain,
Formatters fluent, clean refrain,
Code now graceful, timestamps tame! 🕐

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop
Title check ✅ Passed The title 'chore(omnichannel): remove moment dependency from ChatInfo' clearly and directly summarizes the main change in the pull request, which is the removal of the moment dependency from the ChatInfo component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@ggazzo ggazzo changed the title fix(omnichannel): remove moment dependency from ChatInfo chore(omnichannel): remove moment dependency from ChatInfo Feb 25, 2026
@ggazzo ggazzo closed this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants