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

Stats: Override the query period for custom ranges on Summary pages #98328

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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 client/my-sites/stats/summary/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ class StatsSummary extends Component {
};

// Update query with date range if it provided.
// Note that we force the period to 'day' for custom date ranges as other periods do not make sense
// in the context of our updated Traffic page and do not match the results as shown there.
const dateRange = this.props.dateRange;
if ( dateRange ) {
query.start_date = dateRange.startDate.format( 'YYYY-MM-DD' );
query.date = dateRange.endDate.format( 'YYYY-MM-DD' );
query.summarize = 1;
query.period = 'day'; // Override for custom date ranges.
}

const moduleQuery = merge( {}, statsQueryOptions, query );
Expand Down
Loading