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