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

Feature/last x days parameter #4333

Merged
merged 2 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions client/app/components/dynamic-parameters/DateRangeParameter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ const DYNAMIC_DATE_OPTIONS = [
{ name: 'Last 7 days',
value: getDynamicDateRangeFromString('d_last_7_days'),
label: () => getDynamicDateRangeFromString('d_last_7_days').value()[0].format('MMM D') + ' - Today' },
{ name: 'Last 14 days',
value: getDynamicDateRangeFromString('d_last_14_days'),
label: () => getDynamicDateRangeFromString('d_last_14_days').value()[0].format('MMM D') + ' - Today' },
{ name: 'Last 30 days',
value: getDynamicDateRangeFromString('d_last_30_days'),
label: () => getDynamicDateRangeFromString('d_last_30_days').value()[0].format('MMM D') + ' - Today' },
{ name: 'Last 60 days',
value: getDynamicDateRangeFromString('d_last_60_days'),
label: () => getDynamicDateRangeFromString('d_last_60_days').value()[0].format('MMM D') + ' - Today' },
{ name: 'Last 90 days',
value: getDynamicDateRangeFromString('d_last_90_days'),
label: () => getDynamicDateRangeFromString('d_last_90_days').value()[0].format('MMM D') + ' - Today' },
];

const DYNAMIC_DATETIME_OPTIONS = [
Expand Down
16 changes: 16 additions & 0 deletions client/app/services/parameters/DateRangeParameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ const DYNAMIC_DATE_RANGES = {
name: 'Last 7 days',
value: () => [moment().subtract(7, 'days'), moment()],
},
last_14_days: {
name: 'Last 14 days',
value: () => [moment().subtract(14, 'days'), moment()],
},
last_30_days: {
name: 'Last 30 days',
value: () => [moment().subtract(30, 'days'), moment()],
},
last_60_days: {
name: 'Last 60 days',
value: () => [moment().subtract(60, 'days'), moment()],
},
last_90_days: {
name: 'Last 90 days',
value: () => [moment().subtract(90, 'days'), moment()],
},
};

export const DynamicDateRangeType = PropTypes.oneOf(values(DYNAMIC_DATE_RANGES));
Expand Down