From d6a065df2747c2a51d806d5796cd9073cc230516 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 16:13:35 +0000 Subject: [PATCH] --- .../api/relative-date-filter-calculator.js | 29 ++++++++++++++++++- ayanova/src/components/gz-data-table.vue | 6 ++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index ea19028c..60a8ab01 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -6,7 +6,7 @@ { name: vm.lt("DateRangeTomorrow"), id: "**" }, { name: vm.lt("DateRangeLastWeek"), id: "**" }, { name: vm.lt("DateRangeThisWeek"), id: "**" }, - { name: vm.lt("DateRangeNextWeek"), id: "*nextweek*" }, + { name: vm.lt("DateRangeNextWeek"), id: "**" }, { name: vm.lt("DateRangeLastMonth"), id: "*lastmonth*" }, { name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" }, { name: vm.lt("DateRangeNextMonth"), id: "*nextmonth*" }, @@ -128,6 +128,33 @@ export default { ret.after = dtAfter.toUTC().toString(); ret.before = dtBefore.toUTC().toString(); break; + + case "*nextweek*": + //Between Next Sunday at midnight and Next Next sunday at midnight + + //Start with today + var dtAfter = dtToday; + //If today is monday skip over it first, we're looking for *next* monday, not this one + if (dtAfter.weekday == 1) { + dtAfter = dtAfter.plus({ days: 1 }); + } + + //go forwards to next monday 12:00am (In Luxon Monday is 1, Sunday is 7) + while (dtAfter.weekday != 1) { + dtAfter = dtAfter.plus({ days: 1 }); + } + //Now go back to sunday last second + dtAfter = dtAfter.plus({ seconds: -1 }); + + //set dtBefore 7 days ahead of dtAfter + //(sb BEFORE two mondays from now at zero hour so need to add a second due to prior removal of a second to make sunday) + var dtBefore = dtAfter.plus({ days: 7, seconds: 1 }); + + //set return values from calculated values + ret.after = dtAfter.toUTC().toString(); + ret.before = dtBefore.toUTC().toString(); + + break; } return ret; diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 77fcf3d3..aceae8f4 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -914,10 +914,10 @@ function loadFormSettings(vm) { function untokenizeListView(lv) { //it has one or more tokens //iterate the array and build a new array with substituted tokens with the correct date and time in them - console.log(lv); + //console.log(lv); //console.log(JSON.parse(lv)); - console.log("test:thisweek"); - console.log(relativeDatefilterCalculator.tokenToDates("*thisweek*")); + console.log("test:nextweek"); + console.log(relativeDatefilterCalculator.tokenToDates("*nextweek*")); //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] if (lv == null) { return lv;