Skip to content

Commit

Permalink
Merge pull request #1380 from plone/laulaz-fix-recurrence-edition
Browse files Browse the repository at this point in the history
Fix comparisons between different dates formats
  • Loading branch information
petschki authored May 13, 2024
2 parents 2058cfb + c69c88e commit 01ca324
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pat/recurrence/recurrence.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,14 +690,15 @@ const RecurrenceInput = function (conf, textarea) {
function occurrenceAdd(event) {
event.preventDefault();
var datevalue = self.$modalForm.find(".riaddoccurrence input#adddate").val();
var date_parts = datevalue.split("-");
datevalue += datevalue.length === 10 ? "T000000" : "";
var errorarea = self.$modalForm.find(".riaddoccurrence div.alert");
errorarea.text("");
errorarea.hide();

// Add date only if it is not already in RDATE
if (!textarea["ical"].RDATE.includes(datevalue)) {
textarea["ical"].RDATE.push(datevalue);
var date_parts = datevalue.split("-");
var $newdate =
$(`<div class="d-flex justify-content-between occurrence rdate">
<span class="rdate">
Expand Down Expand Up @@ -772,6 +773,7 @@ const RecurrenceInput = function (conf, textarea) {
y = parseInt(date.substring(0, 4), 10);
m = parseInt(date.substring(4, 6), 10) - 1; // jan=0
d = parseInt(date.substring(6, 8), 10);
occurrence.date = `${y}-${zeropad(m+1)}-${zeropad(d)}T000000`;
occurrence.formattedDate = format(
new Date(y, m, d),
conf.localization.longDateFormat,
Expand Down

0 comments on commit 01ca324

Please sign in to comment.