* fix for borken dates on presentations.

Conflicts:

	openstack/code/Presentation.php
This commit is contained in:
Sebastian Marcet 2014-11-02 03:05:40 -03:00
parent 0a782e1a94
commit caf9f2a016
1 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,4 @@
<?php
/**
* Copyright 2014 Openstack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
@ -73,19 +72,29 @@ class Presentation extends DataObject
return $fields;
}
function FormattedStartTime()
{
$Date = new DateTime($this->StartTime);
return $Date->format('l h:i a');
$start_time = trim(str_replace("p.m.", "", trim($this->StartTime)));
$date = DateTime::createFromFormat('d/m/y H:i', $start_time);
if (!$date)
$date = DateTime::createFromFormat('Y-m-d H:i:s', $start_time);
if ($date)
return $date->format('l h:i a');
return 'N/A';
}
function PresentationDay()
{
$Date = new DateTime($this->StartTime);
return $Date->format('M d');
$start_time = trim(str_replace("p.m.", "", trim($this->StartTime)));
$date = DateTime::createFromFormat('d/m/y H:i', $start_time);
if (!$date)
$date = DateTime::createFromFormat('Y-m-d H:i:s', $start_time);
if ($date)
return $date->format('M d');
return 'N/A';
}
function onBeforeWrite()
{
parent::onBeforeWrite();
@ -214,4 +223,3 @@ class Presentation extends DataObject
}
}
}