diff --git a/client/components/common/CONSTANTS.js b/client/components/common/CONSTANTS.js index a173b3938..a11c19a68 100644 --- a/client/components/common/CONSTANTS.js +++ b/client/components/common/CONSTANTS.js @@ -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, }, ]; @@ -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', diff --git a/client/v1/components/main/menu/DateSelector/DateSelector.jsx b/client/v1/components/main/menu/DateSelector/DateSelector.jsx index 9abe49526..3111dfb4f 100644 --- a/client/v1/components/main/menu/DateSelector/DateSelector.jsx +++ b/client/v1/components/main/menu/DateSelector/DateSelector.jsx @@ -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 }; }; @@ -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 => {