fix(timeRangeSelector): Allow selecting today's UTC date

With UTC enabled, the absolute date range picker still capped the
calendar at the local `new Date()`. When the local date was a day
behind UTC, today's UTC date was disabled and could not be picked.

Convert the max date with `getUtcToSystem` when `utc` is set, the
same conversion the selector already applies to the start and end
dates.
This commit is contained in:
dualfroz committed 2026-10-17 04:21:20 +02:00
1 parent 6909f35d48
commit f21570224e
2 files changed
+37 -1

No files matched your search

@@ -16,6 +16,7 @@ import {trackAnalytics} from 'sentry/utils/analytics';
import {
getEndOfDay,
getStartOfPeriodAgo,
getUtcToSystem,
isValidTime,
setDateToTime,
} from 'sentry/utils/dates';
@@ -195,7 +196,7 @@ class BaseDateRange extends Component<Props, State> {
// (or really, Jan 2 @ 00:00:00 - 1 second), while the start time is at 00:00
let minDate = getStartOfPeriodAgo('days', (maxPickableDays ?? MAX_PICKABLE_DAYS) - 1);
let maxDate = new Date();
let maxDate = utc ? getUtcToSystem(new Date()) : new Date();
// if the start and end date are the same, it means the user can still select another date,
// at this point we want to apply the maxDateRange