Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Chat filtering breaks when "From" and "To" have the same date #35616

Merged
merged 4 commits into from
Mar 27, 2025

Conversation

aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Mar 25, 2025

Proposed changes (including videos or screenshots)

This PR fixes an issue where date-only strings used to filter the chats were incorrectly interpreted due to JavaScript's handling of Date objects.

Quick explanation:

When initializing a date with new Date('2025-03-26'), JavaScript assumes the input is in UTC (2025-03-26T00:00:00.000Z). However, when converted to local time (e.g., in a UTC-3 timezone), the result shifts to 2025-03-25T21:00:00.000Z, causing an unintended date mismatch.

The fix ensures that dates are initialized in a way that preserves the intended local time, preventing incorrect dates from being sent to the rooms endpoints.

Issue(s)

SUP-753

Steps to test or reproduce

  • Start a workspace
  • Go to Omnichannel Contact Center
  • Within the chats tab, click Filters
  • Set "From" and "To" to the same date
  • Apply
  • Filter should show chats for that date

(Previously it would not show chats correctly)

Further comments

  • More details about how dates behave can be found here
  • This issue was introduced on #32727

Copy link
Contributor

dionisio-bot bot commented Mar 25, 2025

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

  • This PR is targeting the wrong base branch. It should target 7.6.0, but it targets 7.5.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Mar 25, 2025

🦋 Changeset detected

Latest commit: 7a4eebf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

github-actions bot commented Mar 25, 2025

PR Preview Action v1.6.0

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35616/

Built to branch gh-pages at 2025-03-27 06:22 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link

codecov bot commented Mar 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.72%. Comparing base (6f44f0e) to head (7a4eebf).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35616   +/-   ##
========================================
  Coverage    59.72%   59.72%           
========================================
  Files         2829     2829           
  Lines        68243    68243           
  Branches     15126    15126           
========================================
  Hits         40759    40759           
  Misses       24876    24876           
  Partials      2608     2608           
Flag Coverage Δ
unit 75.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aleksandernsilva aleksandernsilva changed the title fix: Unable to filter chats when "From" and "To" are the same dates fix: Chat filtering breaks when "From" and "To" have the same date Mar 25, 2025
@aleksandernsilva aleksandernsilva marked this pull request as ready for review March 26, 2025 18:27
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner March 26, 2025 18:27
@aleksandernsilva aleksandernsilva added this to the 7.6.0 milestone Mar 26, 2025
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Mar 27, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 27, 2025
@kodiakhq kodiakhq bot merged commit a4f2ecb into develop Mar 27, 2025
48 checks passed
@kodiakhq kodiakhq bot deleted the fix/cc-chats-filters branch March 27, 2025 06:58
@scuciatto
Copy link
Member

/patch

Copy link
Contributor

dionisio-bot bot commented Mar 31, 2025

Pull request #35659 added to Project: "Patch 7.4.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants