From a48336ed2058c0ac27331b33e10118db36444ced Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 17:54:43 +0000 Subject: [PATCH] --- .../src/api/relative-date-filter-calculator.js | 15 ++++++++++++++- ayanova/src/components/gz-data-table.vue | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index bac92fea..12fe2379 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -11,7 +11,7 @@ { name: vm.lt("DateRangeThisMonth"), id: "**" }, { name: vm.lt("DateRangeNextMonth"), id: "**" }, { name: vm.lt("DateRange14DayWindow"), id: "**" }, - { name: vm.lt("DateRangePast"), id: "*past*" }, + { name: vm.lt("DateRangePast"), id: "**" }, { name: vm.lt("DateRangeFuture"), id: "*future*" }, { name: vm.lt("DateRangeLastYear"), id: "*lastyear*" }, //prior year from jan to dec { name: vm.lt("DateRangeThisYear"), id: "*thisyear*" }, @@ -44,6 +44,9 @@ export default { //return object contains the two dates that encompass the time period //the token represents to the local browser time zone but in UTC //and iso8601 format + + //NOTE: it's valid for one of the two ret values might be undefined as it's valid to have a single date for + //Past or Future var ret = { after: undefined, before: undefined }; var dtNow = window.$gz.DateTime.local(); var dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day); @@ -218,6 +221,16 @@ export default { ret.after = dtAfter.toUTC().toString(); ret.before = dtBefore.toUTC().toString(); break; + + case "*past*": + //Any time before Now + //current moment + var dtBefore = dtNow; + + //set return values from calculated values + ret.after = undefined; + 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 c675a3ac..7fa8143b 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:14daywindow"); - console.log(relativeDatefilterCalculator.tokenToDates("*14daywindow*")); + console.log("test:past"); + console.log(relativeDatefilterCalculator.tokenToDates("*past*")); //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] if (lv == null) { return lv;