admin hours timezone problem

This commit is contained in:
Daniel Camargo 2014-03-28 18:55:45 -03:00
parent 2bea6a43b6
commit ec8031e64a

View File

@ -93,11 +93,23 @@ class Crunchbutton_Admin_Hour extends Cana_Table {
public function date_end(){ public function date_end(){
if ( !isset( $this->_date_end ) ) { if ( !isset( $this->_date_end ) ) {
$this->_date_end = DateTime::createFromFormat( 'Y-m-d H:i:s', $this->date_end, new DateTimeZone( $this->admin()->timezone ) ); if( Crunchbutton_Admin_Hour::validateTimezone( $this->admin()->timezone ) ){
$this->_date_end = DateTime::createFromFormat( 'Y-m-d H:i:s', $this->date_end, new DateTimeZone( $this->admin()->timezone ) );
} else {
echo '<pre>';var_dump( $this->admin() );exit();
}
} }
return $this->_date_end; return $this->_date_end;
} }
public function validateTimezone( $timezone ){
if ( in_array( $timezone, DateTimeZone::listIdentifiers() ) ) {
return true;
}
return false;
}
public function admin(){ public function admin(){
if ( !isset( $this->_admin ) ) { if ( !isset( $this->_admin ) ) {
$this->_admin = Admin::o( $this->id_admin ); $this->_admin = Admin::o( $this->id_admin );