mirror of https://github.com/OCA/web.git
[IMP] web_time_range_menu_custom: Dates include today but other granularities not
parent
8592d3fc75
commit
52124d85d3
|
@ -137,13 +137,25 @@ patch(dates, "patch dates", {
|
|||
setParam.month = dates.QUARTERS[setParam.quarter].coveredMonths[0];
|
||||
delete setParam.quarter;
|
||||
}
|
||||
const plusParamReferenceMoment = referenceMoment.plus(plusParam || {});
|
||||
const date = referenceMoment.set(setParam).plus(plusParam || {});
|
||||
// Compute domain
|
||||
const leftDate = date.startOf(granularity);
|
||||
var leftDate = date.startOf(granularity);
|
||||
var rightDate = date.endOf(granularity);
|
||||
if (custom_period.is_custom_period) {
|
||||
rightDate = plusParamReferenceMoment;
|
||||
if (
|
||||
custom_period.is_custom_period &&
|
||||
parseInt(custom_period.last_period) !== 0
|
||||
) {
|
||||
if (granularity === "day") {
|
||||
const plusParamReferenceMoment = referenceMoment.plus(plusParam || {});
|
||||
leftDate = leftDate.plus({days: 1});
|
||||
rightDate = plusParamReferenceMoment;
|
||||
} else {
|
||||
var customPlusParam = {};
|
||||
customPlusParam[granularity + "s"] = parseInt(
|
||||
custom_period.last_period
|
||||
);
|
||||
rightDate = leftDate.plus(customPlusParam);
|
||||
}
|
||||
}
|
||||
let leftBound;
|
||||
let rightBound;
|
||||
|
|
Loading…
Reference in New Issue