From f43e4e8d88ca90d4b6b4ee0aded998e09e4ce89a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 15:42:20 +0000 Subject: [PATCH] --- .../api/relative-date-filter-calculator.js | 35 +++++++++++++++++-- ayanova/src/components/gz-data-table.vue | 4 +-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index 40b7376d..f63ae16c 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -3,8 +3,8 @@ /* - { name: vm.lt("DateRangeTomorrow"), id: "*tomorrow*" }, - { name: vm.lt("DateRangeLastWeek"), id: "*lastweek*" }, + { name: vm.lt("DateRangeTomorrow"), id: "**" }, + { name: vm.lt("DateRangeLastWeek"), id: "**" }, { name: vm.lt("DateRangeThisWeek"), id: "*thisweek*" }, { name: vm.lt("DateRangeNextWeek"), id: "*nextweek*" }, { name: vm.lt("DateRangeLastMonth"), id: "*lastmonth*" }, @@ -68,6 +68,37 @@ export default { .toUTC() .toString(); break; + case "*tomorrow*": + //Between Tonight at midnight and day after tommorow at midnight + ret.after = dtToday + .plus({ days: 1, seconds: -1 }) + .toUTC() + .toString(); + ret.before = dtToday + .plus({ days: 2 }) + .toUTC() + .toString(); + break; + case "*lastweek*": + //Between two Sundays ago at midnight and last sunday at midnight + + //go back a week + var dtAfter = dtToday.plus({ days: -7 }); + //go backwards to Sunday (In Luxon Monday is 1, Sunday is 7) + while (dtAfter.weekday != 7) { + console.log("dow:" + dtAfter.weekday + ", is " + dtAfter.weekdayLong); + dtAfter = dtAfter.plus({ days: -1 }); + } + //go to very start of eighth dayahead + var dtBefore = dtAfter.plus({ days: 8 }); + //remove 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(); + ret.after = dtAfter.toString(); + ret.before = dtBefore.toString(); + break; } return ret; diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index b07f60e4..2d5a7b74 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -924,7 +924,7 @@ 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:yesterday"); - console.log(relativeDatefilterCalculator.tokenToDates("*yesterday*")); + console.log("test:lastweek"); + console.log(relativeDatefilterCalculator.tokenToDates("*lastweek*")); }