Replace strftime() with date() (#360)

strftime is depreciated as of PHP 8.1
This commit is contained in:
Belle Aerni authored and GitHub committed 2022-10-18 09:16:26 -07:00
1 parent fe6cb31e59
commit 1aec4ade28
5 files changed
+11 -12

No files matched your search

+4 -4
View File
@@ -76,16 +76,16 @@ return [
/**
* Set default date format for localized strings.
*
* @see http://php.net/manual/en/function.strftime.php
* @see https://www.php.net/manual/en/datetime.format.php
*/
'locale_date_format' => '%A, %d %B %G',
'locale_date_format' => 'l, d F o',
/**
* Set default time format for localized strings.
*
* @see http://php.net/manual/en/function.strftime.php
* @see https://www.php.net/manual/en/datetime.format.php
*/
'locale_time_format' => ' %T',
'locale_time_format' => ' G:i:s',
/**
* Set location to store sensitive data.
+2 -2
View File
@@ -98,7 +98,7 @@ class Box_TwigExtensions extends AbstractExtension implements InjectionAwareInte
$locale_date_format = $this->di['config']['locale_date_format'];
$format = is_null($format) ? $locale_date_format : $format;
return strftime($format, strtotime($time));
return date($format, strtotime($time));
}
public function twig_bb_datetime($time, $format = null)
@@ -107,7 +107,7 @@ class Box_TwigExtensions extends AbstractExtension implements InjectionAwareInte
$locale_time_format = $this->di['config']['locale_time_format'];
$format = is_null($format) ? $locale_date_format.$locale_time_format : $format;
return strftime($format, strtotime($time));
return date($format, strtotime($time));
}
public function twig_ipcountryname_filter($value)
+2 -3
View File
@@ -1303,12 +1303,11 @@ class Service implements InjectionAwareInterface
$html .= "<img src=\"$url\" height=\"50\" class=\"CompanyLogo\"></img>";
$html .= '<hr class="Rounded">';
}
$invoiceDate = strftime($localeDateFormat, strtotime($this->di['array_get']($invoice, 'due_at', $invoice['created_at'])));
$html .= '<div class="InvoiceInfo">';
$html .= '<p>Invoice number: ' . $invoice['serie_nr'] . '</p>';
$html .= '<p>Invoice date: ' . $invoiceDate . '</p>';
$html .= '<p>Due date: ' . strftime($localeDateFormat, strtotime($invoice['due_at'])) . '</p>';
$html .= '<p>Invoice date: ' . date($localeDateFormat, strtotime($invoice['created_at'])) . '</p>';
$html .= '<p>Due date: ' . date($localeDateFormat, strtotime($invoice['due_at'])) . '</p>';
$html .= '<p>Invoice status: ' . ucfirst($invoice['status']) . '</p>';
$html .= '</div>';
+2 -2
View File
@@ -412,8 +412,8 @@ final class Box_Installer
'sef_urls' => true,
'timezone' => 'UTC',
'locale' => 'en_US',
'locale_date_format' => '%A, %d %B %G',
'locale_time_format' => ' %T',
'locale_date_format' => 'l, d F o',
'locale_time_format' => ' G:i:s',
'path_data' => BB_PATH_ROOT . '/bb-data',
'path_logs' => BB_PATH_ROOT . '/bb-data/log/application.log',