Selected Month Days aren't reflected in the calendar
Virusmater opened this issue · 4 comments
Hi @Virusmater,
Thank your for reporting this.
The current value actually displays the value which is saved in the database but I agree that it would make more sense to update it based on the current selection.
For now the plugin only uses a PHP library. The text representation of the RRule string is retrieved when the field's value is loaded server-side. To make it reactive we would have to import a client-side library such as rrule.js which would make the plugin heavier. I'm not sure if it's worth it. What do you think?
Ahoy,
#1 @marcbelletre thank you for this repo. I had one of those classic moments yesterday of building a field group out that calcs rrules to find that at the end of the workday someone had already done it better than me 🤣 Bravo!
#2 I immediately ran into the same issue described by @Virusmater. The issue appears to be the result of setting the $strict
flag to true
when calling in_array
in class-acf-field-rrule.php
on line 362
. ie:
$selected = is_array($field['value']) && in_array($day, $field['value']['monthdays'], true);
Should be:
$selected = is_array($field['value']) && in_array($day, $field['value']['monthdays']);
Was there a reason for setting $strict = true
?
🚀
Hello there!
I would like to apologize for leaving this issue open for so long. I've been busy and totally forgot about it.
Thank you @perrelet for finding the cause of the bug. It was indeed introduced by PR #12. I have actually no idea why the strict comparison was set up here.
Anyway this has been fixed and will be published in the next release.
Cheers!