added null check fro post_meta_time getter

This commit is contained in:
ruru4143 2023-12-11 23:22:07 +01:00
parent b78bbbe372
commit 5cc9c35811

View file

@ -121,6 +121,9 @@ abstract class Base { // todo renmae to Base_tranformer
*/ */
public function get_post_meta_time( string $key ) { public function get_post_meta_time( string $key ) {
$time = $this->get_post_meta( $key, true ); // todo what if not exists $time = $this->get_post_meta( $key, true ); // todo what if not exists
if ( null === $time ) {
return null;
}
$time = \strtotime( $time ); $time = \strtotime( $time );
return \gmdate( $this->timeformat, $time ); return \gmdate( $this->timeformat, $time );
} }