Skip to content

Commit

Permalink
Merge pull request #1300 from plone/frapell-recurrence-fixes
Browse files Browse the repository at this point in the history
fix(pat recurrence): Fixes for 'Repeat on' for Yearly and Monthly options
  • Loading branch information
petschki committed Apr 5, 2023
2 parents d0ce0c3 + d57d9c2 commit f9917b1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pat/recurrence/recurrence.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ function widgetSaveToRfc5545(form, RDATE, EXDATE, conf, tz) {
} ${day}`;
} else if (yearlyType === "WEEKDAYOFMONTH") {
index = $("select[name=riyearlyweekdayofmonthindex]", form).val();
day = $("select[name=riyearlyweekdayofmonthday]", form).val();
day =
conf.weekdays[
$("select[name=riyearlyweekdayofmonthday]", form).val()
];
month = $("select[name=riyearlyweekdayofmonthmonth]", form).val();
result += `;BYMONTH=${month}`;
if (["MO", "TU", "WE", "TH", "FR", "SA", "SU"].includes(day)) {
Expand Down Expand Up @@ -489,7 +492,8 @@ function widgetLoadFromRfc5545(form, conf, icaldata, force) {
field
.find("select[name=rimonthlyweekdayofmonthindex]")
.val(index);
field.find("select[name=rimonthlyweekdayofmonth]").val(weekday);
const day_index = conf.weekdays.indexOf(weekday);
field.find("select[name=rimonthlyweekdayofmonth]").val(day_index);
}

selectors = field.find("input[name=rimonthlytype]");
Expand Down Expand Up @@ -540,9 +544,11 @@ function widgetLoadFromRfc5545(form, conf, icaldata, force) {
field
.find("select[name=riyearlyweekdayofmonthindex]")
.val(index);

const weekday_index = conf.weekdays.indexOf(weekday);
field
.find("select[name=riyearlyweekdayofmonthday]")
.val(weekday);
.val(weekday_index);
field
.find("select[name=riyearlyweekdayofmonthmonth]")
.val(bymonth);
Expand Down Expand Up @@ -1153,6 +1159,7 @@ const RecurrenceInput = function (conf, textarea) {
input[name=rirangebyoccurrencesvalue],
input[name=rirangebyenddatecalendar],
#rimonthlyoptions select,
#riyearlyoptions select,
#riyearlyinterval select`
)
.on("change", function () {
Expand Down

0 comments on commit f9917b1

Please sign in to comment.