From 72c3187745cf5ed89283d94201d3cd51a61eae82 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 18:13:55 +0000 Subject: [PATCH] --- .../api/relative-date-filter-calculator.js | 34 ++++++++++++++++++- ayanova/src/components/gz-data-table.vue | 4 +-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index b28ae449..9703ec04 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -21,7 +21,7 @@ }, { name: vm.lt("DateRangeInTheLastSixMonths"), - id: "*last6months*" + id: "**" }, { name: vm.lt("DateRangePastYear"), id: "*pastyear*" }, //last 365 days @@ -292,6 +292,38 @@ export default { break; + case "*last6months*": + //From Now minus 6 months + var dtAfter = dtToday.plus({ months: -6 }); + + //Before now + var dtBefore = dtNow; + + //move after back a second for boundary + dtAfter = dtAfter.plus({ seconds: -1 }); + + //set return values from calculated values + ret.after = dtAfter.toUTC().toString(); + ret.before = dtBefore.toUTC().toString(); + + break; + + case "*pastyear*": //last 365 days + //From Now minus 365 days + var dtAfter = dtToday.plus({ days: -365 }); + + //Before now + var dtBefore = dtNow; + + //move after back a second for boundary + dtAfter = dtAfter.plus({ seconds: -1 }); + + //set return values from calculated values + ret.after = dtAfter.toUTC().toString(); + ret.before = dtBefore.toUTC().toString(); + + break; + //-------------------------- } diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 92134a29..75402281 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -916,8 +916,8 @@ function untokenizeListView(lv) { //iterate the array and build a new array with substituted tokens with the correct date and time in them //console.log(lv); //console.log(JSON.parse(lv)); - console.log("test:last3months"); - console.log(relativeDatefilterCalculator.tokenToDates("*last3months*")); + console.log("test:pastyear"); + console.log(relativeDatefilterCalculator.tokenToDates("*pastyear*")); //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] if (lv == null) { return lv;