Skip to content

fix(explore): cross events date selector allow 7d anytime within 30 days#116099

Merged
nikkikapadia merged 6 commits into
masterfrom
nikki/fix/explore-7d-cross-event-max-pickable-day
May 25, 2026
Merged

fix(explore): cross events date selector allow 7d anytime within 30 days#116099
nikkikapadia merged 6 commits into
masterfrom
nikki/fix/explore-7d-cross-event-max-pickable-day

Conversation

@nikkikapadia
Copy link
Copy Markdown
Member

@nikkikapadia nikkikapadia commented May 22, 2026

For cross event queries in explore we only limit the user to making 7 day queries at a time. The only issue was we needed to have the ability to query a 7 day range within the maxPickableDays (of 90 days in this case) but there's no way to do that right now since maxPickableDays doesn't respect maxDateRange. Ideally if there's a maxDateRange the default time periods shown will be within that date range instead of just relying on maxPickableDays. I've only made changes to the logic if BOTH maxPickableDays and maxDateRange are passed in.

I took a look to see if there are any other parts of the app that use maxDateRange and i don't see any references to it so this shouldn't cause odd behaviour on any other date selector :)
Here's what it's looking like:

Screen.Recording.2026-05-22.at.11.41.22.AM.mov

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 22, 2026
Comment thread static/app/views/explore/spans/content.tsx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.58%

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 321ad50. Configure here.

Comment thread static/app/components/pageFilters/container.tsx
@nikkikapadia nikkikapadia marked this pull request as ready for review May 22, 2026 17:53
@nikkikapadia nikkikapadia requested review from a team as code owners May 22, 2026 17:53
Copy link
Copy Markdown
Contributor

@nsdeschenes nsdeschenes left a comment

Choose a reason for hiding this comment

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

Couple of comments, nothing block worthy lmk what you think 😄

Comment on lines +369 to +390
const newDatetime = shouldUseMaxDateRange
? {
period: `${maxPickableDays}d`,
period: `${maxDateRange}d`,
start: null,
end: null,
utc: datetime.utc,
}
: {
...datetime,
period:
parsed.start || parsed.end || parsed.period || shouldUsePinnedDatetime
? datetime.period
: null,
utc: parsed.utc || shouldUsePinnedDatetime ? datetime.utc : null,
};
: shouldUseMaxPickableDays
? {
period: `${maxPickableDays}d`,
start: null,
end: null,
utc: datetime.utc,
}
: {
...datetime,
period:
parsed.start || parsed.end || parsed.period || shouldUsePinnedDatetime
? datetime.period
: null,
utc: parsed.utc || shouldUsePinnedDatetime ? datetime.utc : null,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Instead of a nested ternary like this, could we use an if block, imo it's a tad easier to read

);
});
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should a test be added in checking that absolute date ranges don't get reset as well, just a small regression test 👀

return new Date(start).getTime() < maxStart.getTime();

if (maxDateRange) {
const maxTimeRange = maxDateRange * 24 * 60 * 60 * 1000;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a shared const somewhere in the FE for one day? Wondering if it's worth pulling that out just to be consistent and clearer what we're doing rather than having the raw numbers 🤔

Comment thread static/app/components/pageFilters/container.tsx
@nikkikapadia nikkikapadia merged commit 3eb788a into master May 25, 2026
71 checks passed
@nikkikapadia nikkikapadia deleted the nikki/fix/explore-7d-cross-event-max-pickable-day branch May 25, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants