No Code Attached Yet Information Required
avatar FlorianGeorgiev
FlorianGeorgiev
10 Apr 2023

Steps to reproduce the issue

Vanilla J 4.2.9 (i spotted it in 4.3.2 as well).
Install a second language (Bulgarian in my case).
Make the needed steps, so the second language becomes available.
Log on with the second language (Bulgarian).
Make a new article.
Change the Start or Finish Publishing date.
Then try to save the article.

Expected result

The article should be saved.

Actual result

Trying saving it, it throws an error: 0 Call to a member function format() on bool

System information (as much as possible)

Vanilla Joomla 4.2.9.
PHP 8.2
Second Language installed (Bulgarian).

Additional comments

When the date format for a given language is different than the format of the British English (the default) language, trying to change Start or Finish publishing throw an error: 0 Call to a member function format() on bool. I think this comes from the different date formats of the different languages. For British English is YYYY-MM-DD, for Bulgarian is DD.MM.YYYY.
I tried to use the British English date formatting while I'm logged with Bulgarian language, but it still throws an error.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar FlorianGeorgiev FlorianGeorgiev - open - 10 Apr 2023
avatar FlorianGeorgiev FlorianGeorgiev - change - 10 Apr 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Apr 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Apr 2023
avatar FlorianGeorgiev FlorianGeorgiev - change - 10 Apr 2023
Title
Saving article throws an error when trying to change the Start and Finish Publishing dates ona multilingual site
Saving article throws an error when trying to change the Start and Finish Publishing dates on a multilingual site
avatar FlorianGeorgiev FlorianGeorgiev - edited - 10 Apr 2023
avatar richard67
richard67 - comment - 11 Apr 2023

@FlorianGeorgiev I think that the error is in the Bulgarian language pack (and possibly also others).

The date formats are defined in file language/<tag>/joomla.ini, with <tag> being the language tag, e.g. "bg-BG".

The format "DATE_FORMAT_CALENDAR_DATE" has to be consistent with "DATE_FORMAT_FILTER_DATE", and the format "DATE_FORMAT_CALENDAR_DATETIME" has to be consistent with "DATE_FORMAT_FILTER_DATETIME".

Consistent means they should have the same order of parts and the same separator.

Correct in the en-GB core file:

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

Correct in the latest German language pack:

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"

Incorrect in the latest Bulgarian language pack:

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"

As you can see, the "DATE_FORMAT_CALENDAR_..." strings use the right Bulgarian format, which is the same as in German by the way, but the "DATE_FORMAT_FILTER_..." strings use the wrong date separators "-".

Could you change the "DATE_FORMAT_FILTER_DATE" and "DATE_FORMAT_FILTER_DATETIME" so they are the same as in the German example above, then test if that helped and then report back the result here?

If I'm right, then it's not an issue with the CMS core but with the translation, then it should be reported to the Bulgarian translation team coordinator, which can be found here https://downloads.joomla.org/language-packs/translations-joomla4 .

avatar richard67 richard67 - change - 11 Apr 2023
Labels Added: Information Required
avatar richard67 richard67 - labeled - 11 Apr 2023
avatar FlorianGeorgiev
FlorianGeorgiev - comment - 13 Apr 2023

Wooow, this is just amazing! @richard67, thank you for helping me out.
I edited joomla.ini for my language and it worked out!
I even didn't know that these formats are stored in a leanguage file, i thought there are somewhere in a php and i'm not a developer, so.. you understand.
I changed the formats like this:
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"

Since we use fullstops for separators of the date elements, I put fullstops.
There are another 4 strings (variables) which I am uncertain if I must change them as well.
Here they are:
DATE_FORMAT_LC4="d-m-Y"
DATE_FORMAT_LC5="d-m-Y H:i"
DATE_FORMAT_LC6="d-m-Y H:i:s"
DATE_FORMAT_JS1="d-m-y"

As you can see, they use dashes instead of fullstops. Should I edit them accordingly as well and put fullstops instead of dashes?

Thanks in advance.

Once we finish here, I'll report it to the coordinator of the Bulgarian language (if there is one). I even could provide the joomla.ini file.

Thanks again.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.
avatar richard67
richard67 - comment - 13 Apr 2023

Since we use fullstops for separators of the date elements, I put fullstops. There are another 4 strings (variables) which I am uncertain if I must change them as well. Here they are: DATE_FORMAT_LC4="d-m-Y" DATE_FORMAT_LC5="d-m-Y H:i" DATE_FORMAT_LC6="d-m-Y H:i:s" DATE_FORMAT_JS1="d-m-y"

As you can see, they use dashes instead of fullstops. Should I edit them accordingly as well and put fullstops instead of dashes?

@FlorianGeorgiev Yes, those can be changed, too. They are only used for formatting output so not cause such an error like it was with the calendar formats, but they should of course fit to your country. As far as I can see, the only difference between Bulgarian and German is that we use also a dot with the long month names, e.g. "13. Mai", while you do not use the dots in the these formats. And these formats are already correct in the Bulgarian language file, so with my suggested change and the additional change mentioned by you it would be completely ok.

Once we finish here, I'll report it to the coordinator of the Bulgarian language (if there is one). I even could provide the joomla.ini file.

That would be great. You find the coordinator for each language here: https://downloads.joomla.org/language-packs/translations-joomla4 .

avatar FlorianGeorgiev
FlorianGeorgiev - comment - 13 Apr 2023

I was talking about /language/bg-BG/joomla.ini

Now I found another file with mixed (I think so) date formats. It is /api/language/bg-BG/joomla.ini
So I edited them as well.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.
avatar FlorianGeorgiev
FlorianGeorgiev - comment - 13 Apr 2023

Sorry for the multiple replies.
I found another file with mixed date formats: /administrator/language/bg-BG/joomla.ini
It could help someone.

p.s. I already found the coordinator and send him a message.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.
avatar richard67 richard67 - change - 13 Apr 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-04-13 16:04:21
Closed_By richard67
avatar richard67
richard67 - comment - 13 Apr 2023

@FlorianGeorgiev Yes, the other files might need to be fixed, too. Thanks for notifying the coordinator. I close the issue here because it's not an issue with the CMS core.

avatar richard67 richard67 - close - 13 Apr 2023

Add a Comment

Login with GitHub to post a comment