Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.1.2
-
Component/s: Core CiviCRM
-
Labels:None
Description
The smarty template plugin function CRM/Core/Smarty/plugins/modifier.crmDate.php does not accept data formatting argument. In smarty template files, if dateformat strings are added as an argument to crmDate then they have no effect.
For example, in CRM/Grant/Form/Selector.tpl, if the formatting string "%b %E %y" is added to a date:
<td>{$row.grant_decision_date|truncate:10:''|crmDate:'%b %E, %Y'}</td>
then it has no effect on the output.
The reason for this is in CRM/Core/Smarty/plugins/modifier.crmData.phpsdsssssssss, the check for $dateFormat == 0 always evaluates to true regardless of the $dataFormat string, and $dateFormat is then set to null. I'm not sure of the intent of the the three lines shown commented below, but commenting them out fixes the problem.
function smarty_modifier_crmDate($dateString, $dateFormat = null, $onlyTime = false )
{
if ($dateString) {
// if ( $dateFormat == 0 )
PS. This bug may not surfaced until now because none of existing CiviCRM templates use the format option with crmDate.