From 6af02f38d1ee7219e01fd6aa38e11f191686cc3c Mon Sep 17 00:00:00 2001 From: Nyan Lynn Htut Date: Thu, 24 Aug 2017 18:40:53 +0630 Subject: [PATCH] [5.5] Added timezone param for now and today helpers (#20716) * added timezone param for now and today helpers * Update v5.5 changelog --- CHANGELOG-5.5.md | 1 + src/Illuminate/Foundation/helpers.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-5.5.md b/CHANGELOG-5.5.md index 051d120ebdc5..afc6471375ee 100644 --- a/CHANGELOG-5.5.md +++ b/CHANGELOG-5.5.md @@ -174,6 +174,7 @@ - Support multiple patterns in `Str::is()` ([#20108](https://github.com/laravel/framework/pull/20108)) - Speed up `Arr::get()` calls without dot notations ([#20139](https://github.com/laravel/framework/pull/20139)) - Use `report()` helper in `mix()` ([#20603](https://github.com/laravel/framework/pull/20603), [bf0cb82](https://github.com/laravel/framework/commit/bf0cb82a8990d99a0ed504c2fa6684b1c59c9d7e)) +- Added `now()` and `today()` helpers ([#3c888b6](https://github.com/laravel/framework/commit/3c888b6c7b89c3d3f90e9024ffbebed3ee80bd23)) ### Localization - ⚠️ Moved `LoaderInterface` to contracts ([#20460](https://github.com/laravel/framework/pull/20460)) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index ae5512e46cf9..496bcdff9864 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -586,11 +586,12 @@ function mix($path, $manifestDirectory = '') /** * Create a new Carbon instance for the current time. * + * @param \DateTimeZone|string|null $tz * @return \Illuminate\Support\Carbon */ - function now() + function now($tz = null) { - return Carbon::now(); + return Carbon::now($tz); } } @@ -823,11 +824,12 @@ function storage_path($path = '') /** * Create a new Carbon instance for the current date. * + * @param \DateTimeZone|string|null $tz * @return \Illuminate\Support\Carbon */ - function today() + function today($tz = null) { - return Carbon::today(); + return Carbon::today($tz); } }