From 8275d2adf633c2dfd426fe3466ea2530a4fb790a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 18:09:53 +0000 Subject: [PATCH] --- .../api/relative-date-filter-calculator.js | 40 ++++++++++++++++++- ayanova/src/components/gz-data-table.vue | 4 +- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index 225aca52..b28ae449 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -14,10 +14,10 @@ { name: vm.lt("DateRangePast"), id: "**" }, { name: vm.lt("DateRangeFuture"), id: "**" }, { name: vm.lt("DateRangeLastYear"), id: "**" }, - { name: vm.lt("DateRangeThisYear"), id: "*thisyear*" }, + { name: vm.lt("DateRangeThisYear"), id: "**" }, { name: vm.lt("DateRangeInTheLastThreeMonths"), - id: "*last3months*" + id: "**" }, { name: vm.lt("DateRangeInTheLastSixMonths"), @@ -256,6 +256,42 @@ export default { ret.before = dtBefore.toUTC().toString(); break; + + case "*thisyear*": + //From zero hour january 1 this year (minus a second) to zero hour jan 1 next year + + //start with the first day of this year + var dtAfter = window.$gz.DateTime.local(dtNow.year); + + //Before zero hour january 1st next year + var dtBefore = window.$gz.DateTime.local(dtNow.year); + dtBefore = dtBefore.plus({ years: 1 }); + + //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 "*last3months*": + //From Now minus 3 months + var dtAfter = dtToday.plus({ months: -3 }); + + //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 ef66db5f..92134a29 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:lastyear"); - console.log(relativeDatefilterCalculator.tokenToDates("*lastyear*")); + console.log("test:last3months"); + console.log(relativeDatefilterCalculator.tokenToDates("*last3months*")); //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] if (lv == null) { return lv;