Add translation of modified_at time, using php-intl
This commit is contained in:
22
libs/FormatDate.php
Normal file
22
libs/FormatDate.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php namespace Todaymade\Daux;
|
||||
|
||||
use IntlDateFormatter;
|
||||
|
||||
class FormatDate
|
||||
{
|
||||
public static function format($params, $date) {
|
||||
$locale = $params['language'];
|
||||
$datetype = IntlDateFormatter::LONG;
|
||||
$timetype = IntlDateFormatter::SHORT;
|
||||
$timezone = null;
|
||||
|
||||
if (!extension_loaded("intl")) {
|
||||
$locale = 'en';
|
||||
$timezone = 'GMT';
|
||||
}
|
||||
|
||||
$formatter = new IntlDateFormatter($locale, $datetype, $timetype, $timezone);
|
||||
|
||||
return $formatter->format($date);
|
||||
}
|
||||
}
|
Verwijs in nieuw issue
Block a user