Skip to content

Commit

Permalink
Add YearWeek::getFirstDay() and getLastDay()
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Feb 6, 2018
1 parent 0d7629b commit 5f8db58
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/YearWeek.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,26 @@ public function atDay(int $dayOfWeek) : LocalDate
return LocalDate::ofYearDay($this->year - 1, $daysOfPreviousYear + $dayOfYear);
}

/**
* Returns the first day of this week.
*
* @return LocalDate
*/
public function getFirstDay() : LocalDate
{
return $this->atDay(DayOfWeek::MONDAY);
}

/**
* Returns the last day of this week.
*
* @return LocalDate
*/
public function getLastDay() : LocalDate
{
return $this->atDay(DayOfWeek::SUNDAY);
}

/**
* Returns a copy of this YearWeek with the specified period in years added.
*
Expand Down

0 comments on commit 5f8db58

Please sign in to comment.