Example #1
0
 /**
  * Test find max
  */
 public function testFindMax()
 {
     $dates = $this->dates();
     $max = (new \DateTime('@' . strtotime('+1 day')))->format('Y-m-d');
     $this->assertEquals($max, DateTime::max($dates)->format('Y-m-d'));
     $this->assertEquals($max, DateTime::max(new ArrayIterator($dates))->format('Y-m-d'));
     $this->assertEquals($max, call_user_func_array('Zork\\Stdlib\\DateTime::max', $dates)->format('Y-m-d'));
 }
Example #2
0
 /**
  * Get published date
  *
  * @return \DateTime
  */
 public function getRenderedPublished()
 {
     $rendered = $this->getRenderedContent();
     if ($rendered instanceof Content) {
         return DateTime::max($rendered->publishedFrom, $rendered->created);
     }
     return null;
 }