guild/common/helpers/TimeHelper.php

23 lines
451 B
PHP
Raw Normal View History

2021-10-29 17:06:09 +03:00
<?php
namespace common\helpers;
use Yii;
2021-10-29 17:06:09 +03:00
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
class TimeHelper
{
public static function limitTime($time_limit)
{
if ($time_limit === null) {
return 'Не ограничено';
2021-10-29 17:06:09 +03:00
}
return Html::tag(
'span',
Yii::$app->formatter->asDuration(strtotime($time_limit, '0')),
['class' => 'label label-primary']
);
2021-10-29 17:06:09 +03:00
}
}