- Posts: 3
Postings
You can freely browse the forum and post in the community forum.
However, you need a valid license to write posts for support (own a valid commercial software license or have purchased a support membership).
Posts only show once reviewed. This is mainly preventive to keep spam away. Thank you for your understanding!
Date format for Joomla! custom field
- Tomoe
-
Topic Author
- New Member
-
Less
More
IP: 80.15.144.202
6 years 1 month ago #5308
by Tomoe
Date format for Joomla! custom field was created by Tomoe
Hi,
I've got a date custom field which is displayed in LNEP view. It's been displayed as "20 octobre 2020" for example, but I would like to show "Mardi 20 octobre 2020". How can I change date format for this custom field only (not for publishing date for example)?
Best regards
I've got a date custom field which is displayed in LNEP view. It's been displayed as "20 octobre 2020" for example, but I would like to show "Mardi 20 octobre 2020". How can I change date format for this custom field only (not for publishing date for example)?
Best regards
- syw
-
- Administrator
-
Less
More
- Posts: 829
IP: 99.203.186.163
6 years 1 month ago #5309
by syw
Olivier.
Replied by syw on topic Date format for Joomla! custom field
Hi,
The best way to do this is to override the lnep_detail_jfield_calendar.php layout from the components' details folder.
Then you can change the format in that file. It uses the format set in the extension by default.
You can test by field Id to set the format per custom field.
It does not affect the standard date fields, which use the lnep_detail_date.php layout.
To learn how you can override the layout, please check the documentation.
The best way to do this is to override the lnep_detail_jfield_calendar.php layout from the components' details folder.
Then you can change the format in that file. It uses the format set in the extension by default.
You can test by field Id to set the format per custom field.
It does not affect the standard date fields, which use the lnep_detail_date.php layout.
To learn how you can override the layout, please check the documentation.
Olivier.
- Tomoe
-
Topic Author
- New Member
-
Less
More
- Posts: 3
IP: 80.15.144.202
6 years 1 month ago #5310
by Tomoe
Replied by Tomoe on topic Date format for Joomla! custom field
Thanks syw, that's what I done, but adding a "l" in date format didn't change anything
I tried to change drastically date format, suppressing "Y" for example, but nothing changed in date. Override is OK because when I add a css class for example, it's displayed in frontend.
Code:
if ($field_data) { echo '<span class="detail_data">'.HTMLHelper::_('date', $field_data, $params->get('d_format', 'l d F Y')).'</span>';} else { echo '<span class="detail_data">-</span>';}
- syw
-
- Administrator
-
Less
More
- Posts: 829
IP: 24.185.124.166
6 years 1 month ago #5311
by syw
Olivier.
Replied by syw on topic Date format for Joomla! custom field
$params->get('d_format', 'l d F Y') retrieves the format that is set in the extension.
'l d F Y' is the default that would be used if there was no value set in the extension.
Therefore, since you want to set a value that is different than the one that is set in the extension, you should not keep $params->get('d_format', 'l d F Y').
Replace
with
'l d F Y' is the default that would be used if there was no value set in the extension.
Therefore, since you want to set a value that is different than the one that is set in the extension, you should not keep $params->get('d_format', 'l d F Y').
Replace
Code:
HTMLHelper::_('date', $field_data, $params->get('d_format', 'l d F Y'))
Code:
HTMLHelper::_('date', $field_data, 'l d F Y')
Olivier.
- Tomoe
-
Topic Author
- New Member
-
Less
More
- Posts: 3
IP: 80.15.144.202
6 years 1 month ago #5312
by Tomoe
Replied by Tomoe on topic Date format for Joomla! custom field
Thanks Olivier! I wasn't definitely unable to do this by myself. Your explanation is very clear.
- syw
-
- Administrator
-
Less
More
- Posts: 829
IP: 24.185.124.166
6 years 1 month ago #5313
by syw
