User tests: Successful: Unsuccessful:
Pull Request for Issue #42790 and a lot more.
When using the calendar field without a format and without setting translateformat="true"
, the field tries to convert the value with strftime()
, which is deprecated and throws a warning. This PR replaces strftime()
with date()
instead and converts the time format from strftime to date-format. To make this as compatible as possible, the conversion method has been extended to include as many conversions as possible. Since this only converts datetimes, the chance that someone is using a format with additional text besides the strftime-format is neglectable.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I get the message only with PHP < 8.2. The patch works as described for this field, but did not test with other configurations. and not sure if this is a good solution.
Field definition in my component.
<field
name="date_from"
type="calendar"
format="%Y-%m-%d"
showtime="false"
label="COM_EVENT_DATE_FROM"
description="COM_EVENT_DATE_FROM_DESC"
/>
@ceford for a test, change the field definiton in a compoment, for example in com_content, article.xml like this or with all possible different settings:
<field
name="created"
type="calendar"
label="COM_CONTENT_FIELD_CREATED_LABEL"
format="%Y-%m-%d"
showtime="false"
filter="user_utc"
/>
and different php versions
Solution of Chat GPT:
If your current code looks like this using strftime():
php
Copiar código
echo strftime('%Y-%m-%d %H:%M:%S', time());
You can replace it with the DateTime object or the date() function as follows:
php
Copiar código
// Using DateTime object
$date = new DateTime();
echo $date->format('Y-m-d H:i:s');
// Or using the date() function
echo date('Y-m-d H:i:s', time());
The solution provided I do not consider a proper solution. I don't want to change the configuration of xml manifest field.
You must solve in the code as described before.
Hi,
sorry for my message I hadn't seen the commit and the changes in code. I have tested in my local joomla web site and it's working fine now, tested succesfully
thanks
@aberenguer78 Can you open https://issues.joomla.org/tracker/joomla-cms/44114 and
The test will count as successfull.
I have tested this item ✅ successfully on bc5ba11
I have replaced the files modified in Joomla core, and the deprecation errors disappear without changing any XML manifest configuration of the component.
I have tested this item ✅ successfully on bc5ba11
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
PR-5.2-dev
|
RTC
Labels |
Added:
RTC
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-11-13 16:29:14 |
Closed_By | ⇒ | pe7er |
Can you give us exact test instructions? I have forgotten what happened previously and I cannot reproduce the error in 5.2.0-beta3-dev.