Skip to content

Commit

Permalink
Merge pull request #10710 from jitendrapurohit/participantfix
Browse files Browse the repository at this point in the history
CRM-17236 - Custom dates fields displayed as (01/01/1970) in Events confirmation receipt
  • Loading branch information
monishdeb authored Jul 21, 2017
2 parents fabcf30 + c65ec45 commit dce8508
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,8 @@ private static function formatDisplayValue($value, $field, $entityId = NULL) {
break;

default:
// if time is not selected remove time from value
$value = substr($value, 0, 10);
//If time is not selected remove time from value.
$value = $value ? date('Y-m-d', strtotime($value)) : '';
}
$customFormat = implode(" ", $customTimeFormat);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/CRM/Core/BAO/CustomQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public function testSearchCustomDataDateFromTo() {
$queryObj->_where[0][0]
);
$this->assertEquals($queryObj->_qill[0][0], "date field BETWEEN 'June 6th, 2014 12:00 AM AND June 6th, 2015 11:59 PM'");

//CRM-17236 - Test custom date is correctly displayed without time.
$formattedValue = CRM_Core_BAO_CustomField::displayValue(date('Ymdhms'), $dateCustomField['id']);
$this->assertEquals(date('m/d/Y'), $formattedValue);
}

/**
Expand Down

0 comments on commit dce8508

Please sign in to comment.