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

Changed initial date range for loading screen from one week proir to … #1431

Closed
wants to merge 2 commits into from
Closed
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: 9 additions & 3 deletions client/components/common/CONSTANTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,9 @@ export const MAP_DATE_RANGES = (() => {

return [
{
id: 'LAST_WEEK',
label: 'Last Week',
startDate: priorDate(1, 'week'),
id: 'LAST_DAY',
label: 'Last Day',
startDate: priorDate(1, 'day'),
endDate,
},
];
Expand All @@ -842,6 +842,12 @@ export const DATE_RANGES = (() => {
}

return [
{
id: 'LAST_DAY',
label: 'Last DAY',
startDate: priorDate(1, 'day'),
endDate,
},
{
id: 'LAST_WEEK',
label: 'Last Week',
Expand Down
50 changes: 27 additions & 23 deletions client/v1/components/main/menu/DateSelector/DateSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ const getDates = dateOptionValue => {
const formatPriorDate = (num, timeInterval) => moment().subtract(num, timeInterval).format('MM/DD/YYYY');

switch (dateOptionValue) {
case 'LAST_WEEK':
newStartDate = formatPriorDate(1, 'week');
break;
case 'LAST_MONTH':
newStartDate = formatPriorDate(1, 'month');
break;
case 'LAST_6_MONTHS':
newStartDate = formatPriorDate(6, 'months');
break;
case 'LAST_12_MONTHS':
newStartDate = formatPriorDate(12, 'months');
break;
case 'YEAR_TO_DATE':
newStartDate = moment().startOf('year').format('MM/DD/YYYY');
break;
case "LAST_DAY":
newStartDate = formatPriorDate(1, "day")
break
case "LAST_WEEK":
newStartDate = formatPriorDate(1, "week")
break
case "LAST_MONTH":
newStartDate = formatPriorDate(1, "month")
break
case "LAST_6_MONTHS":
newStartDate = formatPriorDate(6, "months")
break
case "LAST_12_MONTHS":
newStartDate = formatPriorDate(12, "months")
break
case "YEAR_TO_DATE":
newStartDate = moment().startOf("year").format("MM/DD/YYYY")
break
default:
break;
break
}
return { newStartDate, newEndDate };
};
Expand All @@ -58,13 +61,14 @@ const DateSelector = ({
}) => {
const placeHolder = 'MM/DD/YYYY';
const dateRangeOptions = [
{ label: 'Last Week', value: 'LAST_WEEK' },
{ label: 'Last Month', value: 'LAST_MONTH' },
{ label: 'Last 6 Months', value: 'LAST_6_MONTHS' },
{ label: 'Last 12 months', value: 'LAST_12_MONTHS' },
{ label: 'Year to Date', value: 'YEAR_TO_DATE' },
{ label: 'Custom Date Range', value: 'CUSTOM_DATE_RANGE' },
];
{ label: "Last Day", value: "LAST_DAY" },
{ label: "Last Week", value: "LAST_WEEK" },
{ label: "Last Month", value: "LAST_MONTH" },
{ label: "Last 6 Months", value: "LAST_6_MONTHS" },
{ label: "Last 12 months", value: "LAST_12_MONTHS" },
{ label: "Year to Date", value: "YEAR_TO_DATE" },
{ label: "Custom Date Range", value: "CUSTOM_DATE_RANGE" },
]
const [modalOpen, setModalOpen] = useState(false);

const handleSelection = dateOption => {
Expand Down