-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CalendarField add time in filter also if showtime=false #38978
Comments
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. |
That is diferent bug, the fix already there #43234 |
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. 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 |
Please test PR #44114 |
Steps to reproduce the issue
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.
Expected result
The time should not be added to the value.
Actual result
Time is added to the value.
System information (as much as possible)
PHP 8.1.2
Joomla! 4.2.3
Additional comments
The text was updated successfully, but these errors were encountered: