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

[4.2.7] Custom date field displayed in wrong format after error in registration form #39844

Closed
toivo opened this issue Feb 12, 2023 · 4 comments

Comments

@toivo
Copy link
Contributor

toivo commented Feb 12, 2023

Steps to reproduce the issue

Joomla 4.2.8-dev with en-GB language and the language overrides to simulate en-US:

DATE_FORMAT_LC4="m-d-Y"
DATE_FORMAT_FILTER_DATETIME="m-d-Y H:i:s"
DATE_FORMAT_CALENDAR_DATE="%m-%d-%Y"
DATE_FORMAT_FILTER_DATE="m-d-Y"
DATE_FORMAT_CALENDAR_DATETIME="%m-%d-%Y %H:%M:%S"

Enable the option Allow User Registration.
Create a user custom field of type Calendar, 'Date Of Birth'.
Go to the front end and select the option 'Create an account' from the login module.
Fill in the registration form but use an existing username.
Fill in the Date Of Birth from the Calendar button, for example 01-31-2023.
Click the Register button to submit the form.
The form is displayed with the error 'The username you entered is not available. Please pick another username.'

Expected result

The date field is displayed as 01-31-2023

Actual result

The date field is displayed as 31-01-2023

System information (as much as possible)

Joomla 4.2.8-dev of 12 February 2023, en-GB, on Wampserver 3.2.9 using PHP 8.1.10 in Windows 11

Additional comments

Reported first and discussed in the Joomla forum at https://forum.joomla.org/viewtopic.php?f=808&t=999269
When a new user is created at the back end using an existing username and the error message "Save failed with the following error: Username in use" is received, the custom date is displayed correctly.

@joomdonation
Copy link
Contributor

Just looked at this and for my test, I even see fatal error. Could anyone else confirms that?

@toivo
Copy link
Contributor Author

toivo commented Feb 15, 2023

Thank you for looking into this. The forum member who reported the issue reported this error which I was unable to reproduce with my en-GB language with US overrides:

0 DateTime::__construct(): Failed to parse time string (02-24-2023) at position 0
(0): Unexpected character

Ref. https://forum.joomla.org/viewtopic.php?f=808&t=999269#p3684329


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39844.

@joomdonation
Copy link
Contributor

I did not make language override but installed US language package to test it, but it should work in the same way. Seems PHP DateTime class could not parse a date in US format for some reasons.

@joomdonation
Copy link
Contributor

PR #39863 should address this issue. Please help testing. Thanks !

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

No branches or pull requests

3 participants