diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php index 4e33540..8a3a791 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php @@ -104,4 +104,17 @@ class Event extends BaseEntity public function isValid() { return true; } + + public function getFormatedDate() { + $retval = $this->startdate->format('Y-m-d H:i'); + if (!is_null($this->enddate)) { + $retval .= " — "; + if ($this->startdate->format('Y-m-d') == $this->enddate->format('Y-m-d')) { + $retval .= $this->enddate->format('H:i'); + } else { + $retval .= $this->enddate->format('Y-m-d H:i'); + } + } + return $retval; + } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig index e40664c..84f135a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig @@ -11,7 +11,7 @@
{{ entity.startdate.format('Y-m-d H:i') }} + data-content="Wann?">{{ entity.getFormatedDate() }}
{% if entity.location is not null %}