This commit is contained in:
@@ -6,7 +6,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: "**" },
|
{ 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("DateRangeLastMonth"), id: "*lastmonth*" },
|
||||||
{ name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" },
|
{ name: vm.lt("DateRangeThisMonth"), id: "*thismonth*" },
|
||||||
{ name: vm.lt("DateRangeNextMonth"), id: "*nextmonth*" },
|
{ name: vm.lt("DateRangeNextMonth"), id: "*nextmonth*" },
|
||||||
@@ -128,6 +128,33 @@ export default {
|
|||||||
ret.after = dtAfter.toUTC().toString();
|
ret.after = dtAfter.toUTC().toString();
|
||||||
ret.before = dtBefore.toUTC().toString();
|
ret.before = dtBefore.toUTC().toString();
|
||||||
break;
|
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;
|
return ret;
|
||||||
|
|||||||
@@ -914,10 +914,10 @@ function loadFormSettings(vm) {
|
|||||||
function untokenizeListView(lv) {
|
function untokenizeListView(lv) {
|
||||||
//it has one or more tokens
|
//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
|
//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(JSON.parse(lv));
|
||||||
console.log("test:thisweek");
|
console.log("test:nextweek");
|
||||||
console.log(relativeDatefilterCalculator.tokenToDates("*thisweek*"));
|
console.log(relativeDatefilterCalculator.tokenToDates("*nextweek*"));
|
||||||
//[{"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;
|
||||||
|
|||||||
Reference in New Issue
Block a user