diff --git a/common/models/Job.php b/common/models/Job.php index 9de2ac3..2db8a63 100755 --- a/common/models/Job.php +++ b/common/models/Job.php @@ -45,13 +45,15 @@ class Job extends \yii\db\ActiveRecord public function getExpTime() { - if($this->date_end){ + if($this->date_end && $this->date_start){ $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end)))); + } elseif($this->date_start) { + $now = new \DateTime(); + $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start))); + return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime())); } else { - $now = new \DateTime('now'); - $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $now)))); + return 'неизвестна дата начала'; } } diff --git a/frontend/views/performer/workplace.php b/frontend/views/performer/workplace.php index bdfdf40..64de147 100755 --- a/frontend/views/performer/workplace.php +++ b/frontend/views/performer/workplace.php @@ -1,26 +1,36 @@ params['user'] = $user; -$this->title = 'My Yii Application'; + $this->params[ 'user' ] = $user; + $this->title = 'My Yii Application'; ?>
Опыт работы