This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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*"));
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user