diff --git a/app/Http/helpers.php b/app/Http/helpers.php index c41f710..cc43ca4 100644 --- a/app/Http/helpers.php +++ b/app/Http/helpers.php @@ -106,6 +106,26 @@ function endOfMonth($year, $month, $format='d.m.Y') { ->endOfMonth()->format($format); } +/** + * Return the first day of a given year. + * + * @param string $year + * @return string E. g. 01.01.2018 + */ +function firstDayOfYear($year, $format='d.m.Y') { + return Carbon\Carbon::parse('01.01.' . $year)->format($format); +} + +/** + * Return the last day of a given year. + * + * @param string $year + * @return string E. g. 31.12.2018 + */ +function lastDayOfYear($year, $format='d.m.Y') { + return Carbon\Carbon::parse('31.12.' . $year)->format($format); +} + /** * Check, if all fields of an array are null. * Returns true, if all fields of $array are null. Returns fals,e otherwise