No Code Attached Yet
avatar liuvz
liuvz
24 Jan 2023

Steps to reproduce the issue

  1. There is component com_xxx;
  2. There is a Joomla XML Form for some model in that component;
  3. There is a calendar field with the following settings in that XML form:
    3.1 showtime="false" (The developer wants to use this field only for date info);
    3.2 translateformat="true" (it will use the global language parameter DATE_FORMAT_CALENDAR_DATE);
  4. set Joomla backend language to Greek, its default date format is %d-%m-%Y;
  5. edit an item from that model;
  6. select a date "13-07-2013" (greek format) for the date field mentioned above;
  7. save.

Expected result

"13-07-2013" should be saved successfully, in sql database will be "2013-07-13"

Actual result

Either a fatal error will happen or a completely different date will get saved in database.

System information (as much as possible)

Joomla 4.2, PHP 8

Additional comments

Similar issue happens by the usage of custom field com_fields with a calendar field (date ony) in greek backend.

The issue doesn't happen in greek backend if the calendar field is set with:

  • showtime="true";
  • translateformat="true".
avatar liuvz liuvz - open - 24 Jan 2023
avatar liuvz liuvz - change - 24 Jan 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 24 Jan 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Jan 2023
avatar Fedik
Fedik - comment - 24 Jan 2023

Make sure you edit both DATE_FORMAT_CALENDAR_DATE and DATE_FORMAT_FILTER_DATE.
Check this comment #37000 (comment)

DATE_FORMAT_CALENDAR_DATE="%d-%m-%Y"
DATE_FORMAT_CALENDAR_DATETIME="%d-%m-%Y %H:%M:%S"
DATE_FORMAT_FILTER_DATE="d-m-Y"
DATE_FORMAT_FILTER_DATETIME="d-m-Y H:i:s"
avatar liuvz
liuvz - comment - 24 Jan 2023

Yes by changing the value of DATE_FORMAT_CALENDAR_DATE to the english format, it will work, but it doesn't match the interests of a greek user. It is just a workaround.


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

avatar Fedik
Fedik - comment - 25 Jan 2023

In my comment I posted a constants with default value, you have to change them to your format.
Changing both DATE_FORMAT_CALENDAR_DATE and DATE_FORMAT_FILTER_DATE they should be in sync.

avatar liuvz
liuvz - comment - 25 Jan 2023

Thank you very much! Indeed the error came from the official greek language package:
DATE_FORMAT_CALENDAR_DATE="%d-%m-%Y"
DATE_FORMAT_FILTER_DATE="y-m-d"

I corrected DATE_FORMAT_FILTER_DATE to "d-m-Y", everything works like a charm.


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

avatar liuvz liuvz - change - 25 Jan 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-01-25 09:27:15
Closed_By liuvz
avatar liuvz liuvz - close - 25 Jan 2023

Add a Comment

Login with GitHub to post a comment