event.js
: Fix test for matching the start-date datepicker
#524
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
From what I could test from the current version of the plugin, when editing a recurring event, it seems that the recurrence end date (or “until” date) isn't updated when setting the event start date to a later date.
To reproduce:
2022-10-07
inyyyy-mm-dd
format).2022-10-07
, following the same example).2022-10-31
).2022-10-07
).However, one would expect the “until” date to be updated as well, since it now falls earlier than the event start date. This behavior is actually expected, as per the comment on line 268 of
js/event.js
:Event-Organiser/js/event.js
Lines 265 to 271 in 65c4e3b
From what I could read from the code, it seems that this bug comes from the fact that the element ID of the start-date datepicker in the event editor has changed: it is not
from_date
(as written in the test on line 267 above), buteo-start-date
.A simple fix would be to write
eo-start-date
instead offrom_date
in the above test. However, since the role of each datepicker is now accessible using$(element).data('eo-datepicker')
, it seems to me that matching this string should provide a more robust test for figuring out if we are currently handling events for a particular datepicker. The exact same test is already performed on line 263 of the same file, in the same function:Event-Organiser/js/event.js
Line 263 in 65c4e3b
This is therefore the solution I'm proposing in this PR. From what I could test, this fixes the issue.
Another solution would be to use the jQuery selector
views.start_date
, retrieve the element matching the query, and check that it is the same asthis
. Something likeOf course, I'll gladly update my PR if you think this is a better solution!
I hope this will help! :)
In any case, thank you very much!
Zosterops