[smarcet] - #7691
* fix for borken dates on presentations. Conflicts: openstack/code/Presentation.php
This commit is contained in:
parent
0a782e1a94
commit
caf9f2a016
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2014 Openstack Foundation
|
* Copyright 2014 Openstack Foundation
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -73,19 +72,29 @@ class Presentation extends DataObject
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function FormattedStartTime()
|
function FormattedStartTime()
|
||||||
{
|
{
|
||||||
$Date = new DateTime($this->StartTime);
|
$start_time = trim(str_replace("p.m.", "", trim($this->StartTime)));
|
||||||
return $Date->format('l h:i a');
|
$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()
|
function PresentationDay()
|
||||||
{
|
{
|
||||||
$Date = new DateTime($this->StartTime);
|
$start_time = trim(str_replace("p.m.", "", trim($this->StartTime)));
|
||||||
return $Date->format('M d');
|
$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()
|
function onBeforeWrite()
|
||||||
{
|
{
|
||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
@ -214,4 +223,3 @@ class Presentation extends DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user