This commit is contained in:
2020-03-04 16:00:32 +00:00
parent f483c08b6d
commit bc050e85fc
2 changed files with 43 additions and 12 deletions

View File

@@ -5,7 +5,7 @@
{ name: vm.lt("DateRangeTomorrow"), id: "**" }, { name: vm.lt("DateRangeTomorrow"), id: "**" },
{ name: vm.lt("DateRangeLastWeek"), id: "**" }, { name: vm.lt("DateRangeLastWeek"), id: "**" },
{ name: vm.lt("DateRangeThisWeek"), id: "*thisweek*" }, { name: vm.lt("DateRangeThisWeek"), id: "**" },
{ name: vm.lt("DateRangeNextWeek"), id: "*nextweek*" }, { name: vm.lt("DateRangeNextWeek"), id: "*nextweek*" },
{ name: vm.lt("DateRangeLastMonth"), id: "*lastmonth*" }, { name: vm.lt("DateRangeLastMonth"), id: "*lastmonth*" },
{ name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" }, { name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" },
@@ -93,10 +93,40 @@ export default {
//remove a second for boundary //remove a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 }); dtAfter = dtAfter.plus({ seconds: -1 });
//set return values from calculated values //set return values from calculated values
// ret.after = dtAfter.toUTC().toString(); ret.after = dtAfter.toUTC().toString();
// ret.before = dtBefore.toUTC().toString(); ret.before = dtBefore.toUTC().toString();
ret.after = dtAfter.toString(); break;
ret.before = dtBefore.toString();
case "*thisweek*":
//Between Sunday at midnight and Next sunday at midnight
//Start with today
var dtAfter = dtToday;
//SET dtAfter to Monday start of this week
//go backwards to monday (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 });
//Start with today
var dtBefore = dtToday;
//SET dtBefore to next monday
//is it monday now?
if (dtBefore.weekday == 1) {
//Monday today? then go to next monday
dtBefore = dtBefore.plus({ days: 7 });
} else {
//Find next monday...
while (dtBefore.weekday != 1) {
dtBefore = dtBefore.plus({ days: 1 });
}
}
//set return values from calculated values
ret.after = dtAfter.toUTC().toString();
ret.before = dtBefore.toUTC().toString();
break; break;
} }

View File

@@ -912,19 +912,20 @@ function loadFormSettings(vm) {
//////////////////// ////////////////////
// //
function untokenizeListView(lv) { 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(JSON.parse(lv));
console.log("test:thisweek");
console.log(relativeDatefilterCalculator.tokenToDates("*thisweek*"));
//[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}]
if (lv == null) { if (lv == null) {
return lv; return lv;
} }
//See if it has any date tokens //See if it has any date tokens
if (lv.indexOf('"token":true') == -1) { if (lv.indexOf('"token":true') == -1) {
return; return lv;
} }
//it has one or more tokens return 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:lastweek");
console.log(relativeDatefilterCalculator.tokenToDates("*lastweek*"));
} }
</script> </script>