mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add dedicated :MONTHYEAR reserved keyword
This commit is contained in:
parent
81e507271a
commit
7b7fbc5c13
@ -116,6 +116,11 @@ class Helpers
|
||||
|
||||
$replacements = [
|
||||
'literal' => [
|
||||
':MONTHYEAR' => \sprintf(
|
||||
'%s %s',
|
||||
Carbon::createFromDate(now()->month)->translatedFormat('F'),
|
||||
now()->year,
|
||||
),
|
||||
':MONTH' => Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F'),
|
||||
':YEAR' => now()->year,
|
||||
':QUARTER' => 'Q' . now()->quarter,
|
||||
@ -139,6 +144,7 @@ class Helpers
|
||||
),
|
||||
],
|
||||
'raw' => [
|
||||
':MONTHYEAR' => now()->month,
|
||||
':MONTH' => now()->month,
|
||||
':YEAR' => now()->year,
|
||||
':QUARTER' => now()->quarter,
|
||||
@ -256,6 +262,18 @@ class Helpers
|
||||
$output = \Carbon\Carbon::create()->month($output)->translatedFormat('F');
|
||||
}
|
||||
|
||||
if ($matches->keys()->first() == ':MONTHYEAR') {
|
||||
|
||||
$final_date = now()->addMonths($output-now()->month);
|
||||
|
||||
$output = \sprintf(
|
||||
'%s %s',
|
||||
$final_date->translatedFormat('F'),
|
||||
$final_date->year,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$value = preg_replace(
|
||||
$target, $output, $value, 1
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user