/** * @test */ public function itBringsMondayOnMiddleDay() { // Arrange $reference_date = '2013-03-15'; // Act $monday = DatesTransformer::toMonday(new \DateTime($reference_date)); // Expect $this->assertEquals('2013-03-11', $monday->format('Y-m-d')); }
public function findAllByWeek(\DateTime $date) { $monday = DatesTransformer::toMonday($date)->setTime(0, 0); $sunday = DatesTransformer::toSunday($date)->setTime(0, 0); return $this->findAllByDates($monday, $sunday); }
public function getWeekSheetDays(\DateTime $date) { $first_day = DatesTransformer::toMonday($date); $last_day = DatesTransformer::toSunday($date); return DatesTransformer::getAllDaysBetween($first_day, $last_day); }