Add some period things.

This commit is contained in:
James Cole
2015-09-25 17:28:42 +02:00
parent e12d13c838
commit 38bc38bf26

View File

@@ -109,14 +109,18 @@ class Navigation
public function endOfX(Carbon $theCurrentEnd, $repeatFreq, Carbon $maxDate = null) public function endOfX(Carbon $theCurrentEnd, $repeatFreq, Carbon $maxDate = null)
{ {
$functionMap = [ $functionMap = [
'1D' => 'endOfDay',
'daily' => 'endOfDay', 'daily' => 'endOfDay',
'1W' => 'endOfWeek',
'week' => 'endOfWeek', 'week' => 'endOfWeek',
'weekly' => 'endOfWeek', 'weekly' => 'endOfWeek',
'month' => 'endOfMonth', 'month' => 'endOfMonth',
'1M' => 'endOfMonth', '1M' => 'endOfMonth',
'monthly' => 'endOfMonth', 'monthly' => 'endOfMonth',
'3M' => 'lastOfQuarter',
'quarter' => 'lastOfQuarter', 'quarter' => 'lastOfQuarter',
'quarterly' => 'lastOfQuarter', 'quarterly' => 'lastOfQuarter',
'1Y' => 'endOfYear',
'year' => 'endOfYear', 'year' => 'endOfYear',
'yearly' => 'endOfYear', 'yearly' => 'endOfYear',
]; ];
@@ -146,13 +150,17 @@ class Navigation
public function periodShow(Carbon $date, $repeatFrequency) public function periodShow(Carbon $date, $repeatFrequency)
{ {
$formatMap = [ $formatMap = [
'1D' => '%e %B %Y',
'daily' => '%e %B %Y', 'daily' => '%e %B %Y',
'1W' => 'Week %W, %Y',
'week' => 'Week %W, %Y', 'week' => 'Week %W, %Y',
'weekly' => 'Week %W, %Y', 'weekly' => 'Week %W, %Y',
'3M' => '%B %Y',
'quarter' => '%B %Y', 'quarter' => '%B %Y',
'1M' => '%B %Y', '1M' => '%B %Y',
'month' => '%B %Y', 'month' => '%B %Y',
'monthly' => '%B %Y', 'monthly' => '%B %Y',
'1Y' => '%Y',
'year' => '%Y', 'year' => '%Y',
'yearly' => '%Y', 'yearly' => '%Y',
@@ -220,10 +228,12 @@ class Navigation
public function subtractPeriod(Carbon $theDate, $repeatFreq, $subtract = 1) public function subtractPeriod(Carbon $theDate, $repeatFreq, $subtract = 1)
{ {
$date = clone $theDate; $date = clone $theDate;
// 1D 1W 1M 3M 6M 1Y
$functionMap = [ $functionMap = [
'1D' => 'subDays',
'daily' => 'subDays', 'daily' => 'subDays',
'week' => 'subWeeks', 'week' => 'subWeeks',
'1W' => 'subWeeks',
'weekly' => 'subWeeks', 'weekly' => 'subWeeks',
'month' => 'subMonths', 'month' => 'subMonths',
'1M' => 'subMonths', '1M' => 'subMonths',