Fix assigning end date to content schedule items

This commit is contained in:
Phillip Thelen
2024-04-23 14:40:10 +02:00
parent b0a4ed30d4
commit 80a212683d

View File

@@ -849,10 +849,10 @@ export function getAllScheduleMatchingGroups (date) {
if (!cachedScheduleMatchers[matcher.type]) { if (!cachedScheduleMatchers[matcher.type]) {
cachedScheduleMatchers[matcher.type] = makeMatcherClass(); cachedScheduleMatchers[matcher.type] = makeMatcherClass();
} }
let end = moment(checkedDate); const end = moment(checkedDate);
end.date(TYPE_SCHEDULE[matcher.type]); end.date(TYPE_SCHEDULE[type]);
if (end.date() <= moment(checkedDate).date()) { if (end.date() <= moment(checkedDate).date()) {
end = moment(end).add(1, 'months'); moment(end).add(1, 'months');
} }
cachedScheduleMatchers[matcher.type].end = end.toDate(); cachedScheduleMatchers[matcher.type].end = end.toDate();
if (matcher.matcher instanceof Function) { if (matcher.matcher instanceof Function) {
@@ -863,12 +863,8 @@ export function getAllScheduleMatchingGroups (date) {
}); });
} }
if (!cachedScheduleMatchers[type]) { if (!cachedScheduleMatchers[type]) {
let end = moment(checkedDate).date(TYPE_SCHEDULE[type]); // No matchers exist for this type
if (end.date() <= checkedDate.date()) {
end = moment(end).add(1, 'months');
}
return { return {
end: end.toDate(),
items: [], items: [],
match () { match () {
return true; return true;