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 all 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
15 changes: 10 additions & 5 deletions apps/meteor/client/components/dashboards/periods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const lastNDays =
return { start, end };
};

const getLast6Months = () => {
const last6Months = moment().subtract(6, 'months');
return moment().diff(last6Months, 'days');
};

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

Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3043,7 +3043,6 @@
"Last_30_days": "Last 30 Days",
"Last_90_days": "Last 90 Days",
"Last_6_months": "Last 6 months",
"Last_year": "Last year",
"Last_active": "Last active",
"Last_Call": "Last Call",
"Last_Chat": "Last Chat",
Expand Down Expand Up @@ -4499,6 +4498,7 @@
"Readability": "Readability",
"This_room_is_read_only": "This room is read only",
"This_page_will_be_deprecated_soon": "This page will be deprecated soon",
"This_year": "This Year",
"Only_people_with_permission_can_send_messages_here": "Only people with permission can send messages here",
"Read_only_changed_successfully": "Read only changed successfully",
"Read_only_channel": "Read Only Channel",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/hi-IN.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,6 @@
"Last_30_days": "पिछले 30 दिनों में",
"Last_90_days": "पिछले 90 दिन",
"Last_6_months": "पिछले 6 महीने",
"Last_year": "पिछले साल",
"Last_active": "अंतिम सक्रिय",
"Last_Call": "आखिरी कॉल",
"Last_Chat": "आखिरी चैट",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/nn.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,6 @@
"Last_30_days": "Siste 30 dager",
"Last_90_days": "Siste 90 dager",
"Last_6_months": "Siste 6 måneder",
"Last_year": "I fjor",
"Last_active": "Sist aktiv",
"Last_Call": "Siste samtale",
"Last_login": "Siste innlogging",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/no.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,6 @@
"Last_30_days": "Siste 30 dager",
"Last_90_days": "Siste 90 dager",
"Last_6_months": "Siste 6 måneder",
"Last_year": "I fjor",
"Last_active": "Sist aktiv",
"Last_Call": "Siste samtale",
"Last_login": "Siste innlogging",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,6 @@
"Last_30_days": "Últimos 30 dias",
"Last_90_days": "Últimos 90 dias",
"Last_6_months": "Últimos 6 meses",
"Last_year": "Último ano",
"Last_active": "Ativo pela última vez",
"Last_Call": "Última chamada",
"Last_Chat": "Última conversa",
Expand Down Expand Up @@ -3533,6 +3532,7 @@
"Read_by": "Lido por",
"Read_only": "Somente leitura",
"This_room_is_read_only": "Esta sala é somente leitura",
"This_year": "Este ano",
"Read_only_changed_successfully": "Somente leitura foi alterado com sucesso",
"Read_only_channel": "Canal somente leitura",
"Read_only_group": "Grupo somente de leitura",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/se.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,6 @@
"Last_30_days": "Last 30 Days",
"Last_90_days": "Last 90 Days",
"Last_6_months": "Last 6 months",
"Last_year": "Last year",
"Last_active": "Last active",
"Last_Call": "Last Call",
"Last_Chat": "Last Chat",
Expand Down
Loading