diff --git a/ayanova/src/api/relative-date-filter-calculator.js b/ayanova/src/api/relative-date-filter-calculator.js index 60a8ab01..477b4713 100644 --- a/ayanova/src/api/relative-date-filter-calculator.js +++ b/ayanova/src/api/relative-date-filter-calculator.js @@ -7,7 +7,7 @@ { name: vm.lt("DateRangeLastWeek"), id: "**" }, { name: vm.lt("DateRangeThisWeek"), id: "**" }, { name: vm.lt("DateRangeNextWeek"), id: "**" }, - { name: vm.lt("DateRangeLastMonth"), id: "*lastmonth*" }, + { name: vm.lt("DateRangeLastMonth"), id: "**" }, { name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" }, { name: vm.lt("DateRangeNextMonth"), id: "*nextmonth*" }, { name: vm.lt("DateRange14DayWindow"), id: "*14daywindow*" }, @@ -153,8 +153,23 @@ export default { //set return values from calculated values ret.after = dtAfter.toUTC().toString(); ret.before = dtBefore.toUTC().toString(); - + break; + case "*lastmonth*": + //start with the first day of this month + var dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1); + //subtract a Month + dtAfter = dtAfter.plus({ months: -1 }); + //Add one month to dtAfter to get end date + var dtBefore = dtAfter.plus({ months: 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; + //-------------------------- } return ret; diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index aceae8f4..74ae6faa 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:nextweek"); - console.log(relativeDatefilterCalculator.tokenToDates("*nextweek*")); + console.log("test:lastmonth"); + console.log(relativeDatefilterCalculator.tokenToDates("*lastmonth*")); //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] if (lv == null) { return lv;