Joomla! 4 only
Build a form with this field:
save the form,
In FormController::save:623 ($validData = $model->validate($form, $data);)
the value 2022-10-17 change in 2022-10-17 10:06:12 (with the current time)
This arises in the class/method CalendarField::filter:352 ($value = DateTime::createFromFormat($this->filterFormat, $value)->format('Y-m-d H:i:s');)
I run into the problem where I have a form confirmed (by user) before I save it. When I save the form with the data in the session I get an error (Call to a member function format() on bool ) on the same method (CalendarField::filter:352) because the filterFormat doesn't know that format is changed.
The time should not be added to the value.
Time is added to the value.
PHP 8.1.2
Joomla! 4.2.3
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
bug
|
Thanks for that. I applied the patch and confirm I no longer get the fatal error.
I confirm the bug. I have the same problem.
When I used format="%Y-%m-%d" I receive a date filtered correctly.
But with php 8.2 I have a message "Deprecated: Function strftime() is deprecated ". I have see in this post #42790 to use filterFormat="Y-m-d" but that doesn't work :-(
Indeed with the code showed in this post that doesn't work : CalendarField::filter:352 ($value = DateTime::createFromFormat($this->filterFormat, $value)->format('Y-m-d H:i:s');)
Why you don't correct the code or replace the strftime() function ??? This issue is opened on Oct 17, 2022 :-( it's sad
This problem is also present in 5.1! I created a subform and included in it two instances of a date field. The first time it saved with no problem. On the second save I got the fatal error: Call to a member function format() on false / JROOT/libraries/src/Form/Field/CalendarField.php:400. It seems the filte is Y-m-d but the value has time too.
This is a serious bug!
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38978.