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

Handle client count timezone #15167

Merged
merged 2 commits into from
May 20, 2022
Merged
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
3 changes: 3 additions & 0 deletions changelog/15167.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fixed client count timezone for start and end months
```
6 changes: 4 additions & 2 deletions ui/app/adapters/clients/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import Application from '../application';
import { formatRFC3339 } from 'date-fns';

export default Application.extend({
// Since backend converts the timezone to UTC, sending the first (1) as start or end date can cause the month to change.
// To mitigate this impact of timezone conversion, hard coding the dates to avoid month change.
formatTimeParams(query) {
let { start_time, end_time } = query;
// check if it's an array, if it is, it's coming from an action like selecting a new startTime or new EndTime
if (Array.isArray(start_time)) {
let startYear = Number(start_time[0]);
let startMonth = Number(start_time[1]);
start_time = formatRFC3339(new Date(startYear, startMonth));
start_time = formatRFC3339(new Date(startYear, startMonth, 10));
}
if (end_time) {
if (Array.isArray(end_time)) {
let endYear = Number(end_time[0]);
let endMonth = Number(end_time[1]);
end_time = formatRFC3339(new Date(endYear, endMonth));
end_time = formatRFC3339(new Date(endYear, endMonth, 20));
Copy link
Contributor

Choose a reason for hiding this comment

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

When testing did the API always return with the last day of the month? Might be worth having backend take a look (or maybe you already have) to see if sending an arbitrary middle of the month day has any implications we're unaware of.

}

return { start_time, end_time };
Expand Down