Skip to content

Commit

Permalink
Stats: Fix the range end date comparison with Today (#96859)
Browse files Browse the repository at this point in the history
  • Loading branch information
dognose24 authored Nov 28, 2024
1 parent 0855b87 commit 3db330b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/my-sites/stats/stats-period-navigation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ class StatsPeriodNavigation extends PureComponent {
const isToday = moment( date ).isSame( momentSiteZone, period );

// TODO: Refactor the isNewDateFilteringEnabled dedicated variables.
const isChartRangeEndToday = moment( dateRange?.chartEnd ).isSame( momentSiteZone, period );
const isChartRangeEndSameOrAfterToday = moment( dateRange?.chartEnd ).isSameOrAfter(
momentSiteZone,
'day'
);
const showArrowsForDateRange = showArrows && dateRange?.daysInRange <= 31;

return (
Expand All @@ -266,7 +269,7 @@ class StatsPeriodNavigation extends PureComponent {
<div className="stats-period-navigation__date-range-control">
{ showArrowsForDateRange && (
<NavigationArrows
disableNextArrow={ disableNextArrow || isChartRangeEndToday }
disableNextArrow={ disableNextArrow || isChartRangeEndSameOrAfterToday }
disablePreviousArrow={ disablePreviousArrow }
onClickNext={ this.handleNextRangeDateNavigation }
onClickPrevious={ this.handlePreviousDateRangeNavigation }
Expand Down

0 comments on commit 3db330b

Please sign in to comment.