aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/Conference.php16
-rw-r--r--model/Conferences.php2
2 files changed, 13 insertions, 5 deletions
diff --git a/model/Conference.php b/model/Conference.php
index 07d72dd..ae5ab41 100644
--- a/model/Conference.php
+++ b/model/Conference.php
@@ -33,11 +33,17 @@ class Conference extends ModelBase
}
public function startsAt() {
- return $this->get('CONFERENCE.STARTS_AT');
+ if(!$this->has('CONFERENCE.STARTS_AT'))
+ return null;
+
+ return DateTime::createFromFormat('U', $this->get('CONFERENCE.STARTS_AT'));
}
public function endsAt() {
- return $this->get('CONFERENCE.ENDS_AT');
+ if(!$this->has('CONFERENCE.ENDS_AT'))
+ return null;
+
+ return DateTime::createFromFormat('U', $this->get('CONFERENCE.ENDS_AT'));
}
public function hasBegun() {
@@ -62,7 +68,8 @@ class Conference extends ModelBase
}
if($this->has('CONFERENCE.STARTS_AT')) {
- return time() >= $this->get('CONFERENCE.STARTS_AT');
+ $now = new DateTime('now');
+ return $now >= $this->startsAt();
} else {
return true;
}
@@ -84,7 +91,8 @@ class Conference extends ModelBase
}
if($this->has('CONFERENCE.ENDS_AT')) {
- return time() >= $this->get('CONFERENCE.ENDS_AT');
+ $now = new DateTime('now');
+ return $now >= $this->endsAt();
} else {
return false;
}
diff --git a/model/Conferences.php b/model/Conferences.php
index 2dc9f35..8de4029 100644
--- a/model/Conferences.php
+++ b/model/Conferences.php
@@ -48,7 +48,7 @@ class Conferences
$sorted = Conferences::getConferences();
usort($sorted, function($a, $b) {
- return $b->startsAt() - $a->endsAt();
+ return $b->startsAt() > $a->endsAt() ? 1 : -1;
});
return $sorted;