This commit is contained in:
2020-03-04 16:13:35 +00:00
parent bc050e85fc
commit d6a065df27
2 changed files with 31 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
{ name: vm.lt("DateRangeTomorrow"), id: "**" },
{ name: vm.lt("DateRangeLastWeek"), 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("DateRangeThisMonth"), id: "*thismonth*" },
{ name: vm.lt("DateRangeNextMonth"), id: "*nextmonth*" },
@@ -128,6 +128,33 @@ export default {
ret.after = dtAfter.toUTC().toString();
ret.before = dtBefore.toUTC().toString();
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;