Skip to content
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

[5.2] CalendarField: changing strftime to date #44114

Open
wants to merge 1 commit into
base: 5.2-dev
Choose a base branch
from

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Sep 18, 2024

Pull Request for Issue #42790 and a lot more.

Summary of Changes

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.

Testing Instructions

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Link to documentations

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

@ceford
Copy link
Contributor

ceford commented Sep 19, 2024

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.

@richard67
Copy link
Member

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.

@ceford Maybe it can be tested as described in PR #43947 ? I haven't tried that yet.

@chmst
Copy link
Contributor

chmst commented Sep 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants