guild/common/helpers/TimeHelper.php

22 lines
422 B
PHP
Raw Permalink 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\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
}
}