示例#1
0
 /** @test */
 public function it_can_get_a_new_datetime()
 {
     $loom = Loom::make()->fromDateTime(new DateTime('now'));
     $loom->add(Loom::make()->fromDays(2));
     $dateTime = $loom->getDateTime();
     $this->assertEquals((new DateTime('now + 2 days'))->format('d'), $dateTime->format('d'));
 }
示例#2
0
 /**
  * Get time since
  *
  * @return Loom
  */
 public function since()
 {
     $now = (new \DateTime('now'))->getTimestamp();
     $since = $this->diff(Loom::make()->fromSeconds($now));
     return $since;
 }