Skip to content

Commit 079fc8c

Browse files
committed
no need to add another param for shortcut id
1 parent 21c31a6 commit 079fc8c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

client/my-sites/stats/site.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ function StatsBody( { siteId, chartTab = 'views', date, context, isInternal, ...
581581
showArrows={ ! wpcomShowUpsell }
582582
slug={ slug }
583583
dateRange={ customChartRange }
584-
appliedShortcut={ appliedShortcut }
585584
>
586585
{ ' ' }
587586
<DatePicker

client/my-sites/stats/stats-period-navigation/index.jsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class StatsPeriodNavigation extends PureComponent {
3939
startDate: PropTypes.bool,
4040
endDate: PropTypes.bool,
4141
isWithNewDateControl: PropTypes.bool,
42-
appliedShortcut: PropTypes.object,
4342
};
4443

4544
static defaultProps = {
@@ -51,7 +50,6 @@ class StatsPeriodNavigation extends PureComponent {
5150
startDate: false,
5251
endDate: false,
5352
isWithNewDateControl: false,
54-
appliedShortcut: null,
5553
};
5654

5755
handleArrowEvent = ( arrow, href ) => {
@@ -143,7 +141,7 @@ class StatsPeriodNavigation extends PureComponent {
143141

144142
// TODO: refactor to extract logic with `dateForCustomRange` from `client/my-sites/stats/stats-date-picker/index.jsx`.
145143
getFullPeriod = () => {
146-
const { moment, dateRange, appliedShortcut, momentSiteZone } = this.props;
144+
const { moment, dateRange, momentSiteZone } = this.props;
147145
const localizedStartDate = moment( dateRange.chartStart );
148146
const localizedEndDate = moment( dateRange.chartEnd );
149147

@@ -152,7 +150,7 @@ class StatsPeriodNavigation extends PureComponent {
152150
localizedStartDate.isSame( localizedStartDate.clone().startOf( 'month' ), 'day' ) &&
153151
localizedEndDate.isSame( momentSiteZone, 'day' ) &&
154152
localizedStartDate.isSame( localizedEndDate, 'month' ) &&
155-
( ! appliedShortcut || appliedShortcut.id === 'month_to_date' )
153+
( ! dateRange.shortcutId || dateRange.shortcutId === 'month_to_date' )
156154
) {
157155
return 'month';
158156
}
@@ -162,7 +160,7 @@ class StatsPeriodNavigation extends PureComponent {
162160
localizedStartDate.isSame( localizedStartDate.clone().startOf( 'year' ), 'day' ) &&
163161
localizedEndDate.isSame( momentSiteZone, 'day' ) &&
164162
localizedStartDate.isSame( localizedEndDate, 'year' ) &&
165-
( ! appliedShortcut || appliedShortcut.id === 'year_to_date' )
163+
( ! dateRange.shortcutId || dateRange.shortcutId === 'year_to_date' )
166164
) {
167165
return 'year';
168166
}

0 commit comments

Comments
 (0)