Merge branch 'develop'
commit
a03059ba45
|
@ -24,6 +24,7 @@ import { toast } from 'react-toastify';
|
||||||
import ButtonIcon from '../../common/ButtonIcon';
|
import ButtonIcon from '../../common/ButtonIcon';
|
||||||
import { APIBaseURL } from '../../../config';
|
import { APIBaseURL } from '../../../config';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
|
||||||
|
@ -134,6 +135,10 @@ const MeterBatch = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -260,11 +261,13 @@ const MeterCarbon = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -273,6 +276,10 @@ const MeterCarbon = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -260,11 +261,13 @@ const MeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -273,6 +276,10 @@ const MeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { startOfDay, endOfDay, addDays, subDays } from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -263,11 +264,13 @@ const MeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
|
|
||||||
// Callback fired when value changed
|
// Callback fired when value changed
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -277,6 +280,10 @@ const MeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
@ -296,6 +303,7 @@ const MeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Handler
|
// Handler
|
||||||
const handleSubmit = e => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -29,6 +29,7 @@ import ButtonIcon from '../../common/ButtonIcon';
|
||||||
import { APIBaseURL } from '../../../config';
|
import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
|
||||||
|
@ -241,6 +242,10 @@ const MeterSubmetersBalance = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,7 @@ import { toast } from 'react-toastify';
|
||||||
import ButtonIcon from '../../common/ButtonIcon';
|
import ButtonIcon from '../../common/ButtonIcon';
|
||||||
import { APIBaseURL } from '../../../config';
|
import { APIBaseURL } from '../../../config';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const MeterTracking = ({ setRedirect, setRedirectUrl, t }) => {
|
const MeterTracking = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
|
@ -226,6 +227,10 @@ const MeterTracking = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,7 @@ import { toast } from 'react-toastify';
|
||||||
import ButtonIcon from '../../common/ButtonIcon';
|
import ButtonIcon from '../../common/ButtonIcon';
|
||||||
import { APIBaseURL } from '../../../config';
|
import { APIBaseURL } from '../../../config';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
|
||||||
|
@ -231,6 +232,10 @@ const MeterTrend = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -242,11 +243,13 @@ const OfflineMeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -255,6 +258,10 @@ const OfflineMeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -242,11 +243,13 @@ const OfflineMeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -255,6 +258,10 @@ const OfflineMeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -240,11 +241,13 @@ const VirtualMeterCarbon = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -253,6 +256,10 @@ const VirtualMeterCarbon = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -242,11 +243,13 @@ const VirtualMeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -255,6 +258,10 @@ const VirtualMeterCost = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { APIBaseURL } from '../../../config';
|
||||||
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
import { periodTypeOptions } from '../common/PeriodTypeOptions';
|
||||||
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions';
|
||||||
import { DateRangePicker } from 'rsuite';
|
import { DateRangePicker } from 'rsuite';
|
||||||
|
import { endOfDay} from 'date-fns';
|
||||||
|
|
||||||
|
|
||||||
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable'));
|
||||||
|
@ -242,11 +243,13 @@ const VirtualMeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let onBasePeriodChange = (DateRange) => {
|
let onBasePeriodChange = (DateRange) => {
|
||||||
console.log(DateRange);
|
|
||||||
|
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setBasePeriodDateRange([null, null]);
|
setBasePeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -255,6 +258,10 @@ const VirtualMeterEnergy = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
if(DateRange == null) {
|
if(DateRange == null) {
|
||||||
setReportingPeriodDateRange([null, null]);
|
setReportingPeriodDateRange([null, null]);
|
||||||
} else {
|
} else {
|
||||||
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') {
|
||||||
|
// if the user did not change time value, set the default time to the end of day
|
||||||
|
DateRange[1] = endOfDay(DateRange[1]);
|
||||||
|
}
|
||||||
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]);
|
||||||
if (comparisonType === 'year-over-year') {
|
if (comparisonType === 'year-over-year') {
|
||||||
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]);
|
||||||
|
|
Loading…
Reference in New Issue