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: wrong dates on last x date on omnichannel reports #34113

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/quick-rivers-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@rocket.chat/meteor": patch
---

Fixes dates being incorrect when fetching omnichannel reports with the following time periods:

last week
last month
last 6 months
last year
10 changes: 6 additions & 4 deletions apps/meteor/client/components/dashboards/periods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const lastNDays =
return { start, end };
};

const today = moment();

const periods = [
{
key: 'today',
Expand All @@ -32,7 +34,7 @@ const periods = [
{
key: 'this week',
label: label('This_week'),
range: lastNDays(7),
range: lastNDays(today.day()),
},
{
key: 'last 7 days',
Expand All @@ -47,7 +49,7 @@ const periods = [
{
key: 'this month',
label: label('This_month'),
range: lastNDays(30),
range: lastNDays(today.date()),
},
{
key: 'last 30 days',
Expand All @@ -62,12 +64,12 @@ const periods = [
{
key: 'last 6 months',
label: label('Last_6_months'),
range: lastNDays(180),
range: lastNDays(today.dayOfYear() - today.subtract(6, 'months').dayOfYear()),
},
{
key: 'last year',
label: label('Last_year'),
range: lastNDays(365),
range: lastNDays(today.dayOfYear()),
},
] as const;

Expand Down
Loading