Пример #1
0
 public function testTimeAlwaysHasSameDayEvenIfDeveloperSpecifiesDateAfterConstructor()
 {
     $time = new RhubarbTime("10:00:00");
     $this->assertEquals("2000-01-01 10:00:00", $time->format("Y-m-d H:i:s"));
     $time = new RhubarbTime(new RhubarbDateTime("2010-01-01 10:00"));
     $time->setDate(2010, 02, 05);
     $this->assertEquals("2000-01-01 10:00:00", $time->format("Y-m-d H:i:s"));
 }
Пример #2
0
 public function getTransformIntoRepository()
 {
     return function ($data) {
         $data = new RhubarbTime($data);
         if ($data->isValidDateTime()) {
             $date = $data->format("H:i:s");
         } else {
             $date = "00:00:00";
         }
         return $date;
     };
 }