forked from cccb-website-team/www
Kalender-UI: Berücksichtige INTERVAL und DTSTART bei monatlichen RRULEs.
Der JS-RRULE-Parser im Kalender ignorierte bisher INTERVAL=, sodass z.B. FREQ=MONTHLY;INTERVAL=3 als reines monatliches Event angezeigt wurde. Außerdem wurden monatliche Events auch in Monaten vor ihrem DTSTART angezeigt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
607da4c5fe
commit
0b67ad4cfb
1 changed files with 6 additions and 0 deletions
|
|
@ -131,6 +131,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
else if (rruleStr.includes("FREQ=MONTHLY") && rruleStr.includes("BYDAY")) {
|
||||
const bydayMatch = rruleStr.match(/BYDAY=([^;]+)/);
|
||||
if (bydayMatch) {
|
||||
const intervalMatch = rruleStr.match(/INTERVAL=(\d+)/);
|
||||
const interval = intervalMatch ? parseInt(intervalMatch[1]) : 1;
|
||||
const monthsFromStart = (year - startDate.getFullYear()) * 12 + (month - startDate.getMonth());
|
||||
if (monthsFromStart < 0 || monthsFromStart % interval !== 0) {
|
||||
return [];
|
||||
}
|
||||
const bydays = bydayMatch[1].split(',');
|
||||
const dayMap = {
|
||||
'MO': 1, 'TU': 2, 'WE': 3, 'TH': 4, 'FR': 5, 'SA': 6, 'SU': 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue