Skip to content

Commit

Permalink
Fixed date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
inghamn committed Mar 31, 2016
1 parent a4bb4d5 commit 4be1f37
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions blocks/html/committees/past.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use Blossom\Classes\Url;
foreach ($this->data as $c) {
$uri = BASE_URI.'/committees/info?committee_id='.$c['id'];
$name = self::escape($c['name']);
$endDate = $c['endDate'];
$endDate = new \DateTime($c['endDate']);

echo "
<tr><td><a href=\"$uri\">$name</a></td>
<td>$endDate</td>
<td>{$endDate->format(DATE_FORMAT)}</td>
</tr>
";
}
Expand Down
25 changes: 24 additions & 1 deletion blocks/html/seats/data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,30 @@ $title = $this->title
$userCanEdit = Person::isAllowed('seats', 'edit');

foreach ($this->data['results'] as $row) {
foreach ($row as $f=>$v) { $$f = self::escape($v); }
foreach ($row as $f=>$v)
{
switch ($f) {
case 'seatStart':
case 'seatEnd':
case 'memberStart':
case 'memberEnd':
case 'memberTermStart':
case 'memberTermEnd':
case 'termStart':
case 'termEnd':
if ($v) {
$d = new \DateTime($v);
$$f = $d->format(DATE_FORMAT);
}
else {
$$f = null;
}
break;

default:
$$f = self::escape($v);
}
}

$actions = [];
$classes = [];
Expand Down

0 comments on commit 4be1f37

Please sign in to comment.