3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Convert the date string "YYYY-MM-DD" to "MM<long> DD, YYYY".
21 * @param string $dateString
22 * Date which needs to converted to human readable format.
24 * @param string|null $dateFormat
25 * A string per https://www.php.net/manual/en/function.strftime.php or
26 * one of our configured formats name - eg
27 * - dateformatDatetime
32 * - dateformatFinancialBatch
33 * - dateformatshortdate
35 * @param bool $onlyTime
38 * human readable date format | invalid date message
40 function smarty_modifier_crmDate($dateString, ?
string $dateFormat = NULL, bool $onlyTime = FALSE): string {
42 $configuredFormats = [
51 if (in_array($dateFormat, $configuredFormats, TRUE)) {
52 $dateFormat = Civi
::settings()->get('dateformat' . $dateFormat);
54 // this check needs to be type sensitive
56 if ($dateFormat === 0) {
60 $config = CRM_Core_Config
::singleton();
61 $dateFormat = $config->dateformatTime
;
64 return CRM_Utils_Date
::customFormat($dateString, $dateFormat);