RocketChat / RocketChat/Rocket.Chat

DateRangePicker overrides global Moment locale with moment.locale('en')

Open
#38,652 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

The DateRangePicker component forces Moment’s global locale to English by calling:

moment.locale('en');

at module scope inside:

apps/meteor/client/views/omnichannel/analytics/DateRangePicker.tsx

Since Moment’s locale is global, this overrides Rocket.Chat’s centralized locale handling and may cause inconsistent localization behavior in non-English environments.

Rocket.Chat supports over 80 languages and manages locale globally via its translation provider. A component-level global override conflicts with that design.


Steps to reproduce:
  1. Change the Rocket.Chat UI language to a non-English language (e.g., Arabic or Persian).
  2. Navigate to Omnichannel → Analytics (or any view using DateRangePicker).
  3. Open the browser DevTools console.
  4. Run: moment.locale()
  5. Observe that the locale may return "en" due to the module-level override.

Expected behavior:

Moment locale should follow Rocket.Chat’s global i18n configuration and reflect the currently selected UI language.

No component should override the global locale at module scope.


Actual behavior:

DateRangePicker sets moment.locale('en') globally when the module is imported, potentially overriding the application-wide locale configuration and introducing unintended global side effects.


Server Setup Information:
  • Version of Rocket.Chat Server: develop branch (latest)
  • License Type: N/A (frontend localization issue)
  • Number of Users: N/A
  • Operating System: N/A
  • Deployment Method: N/A
  • Number of Running Instances: N/A
  • DB Replicaset Oplog: N/A
  • NodeJS Version: N/A
  • MongoDB Version: N/A

Client Setup Information
  • Desktop App or Browser Version: Chrome (latest)
  • Operating System: Ubuntu 25.10

Additional context

Rocket.Chat supports over 80 languages through its global localization efforts. Languages are categorized by completeness and managed centrally via the TranslationProvider.

The DateRangePicker formats dates explicitly using YYYY-MM-DD, which does not require forcing English locale. Removing the global locale override would align this component with Rocket.Chat’s localization architecture and prevent unintended side effects.


Relevant logs:

N/A (Localization and global side-effect issue)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/meteor/client/views/omnichannel/analytics/DateRangePicker.tsx and inspect the module-scope moment.locale('en') call. Remove the global locale override, then verify with a non-English UI language that moment.locale() follows Rocket.Chat’s centralized configuration and the DateRangePicker still formats dates as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, internationalization
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.