Skip to content

Commit

Permalink
Merge pull request #7 from brainlet-ali/dev
Browse files Browse the repository at this point in the history
Change default timezone to UTC in config
  • Loading branch information
brainlet-ali authored Jan 22, 2023
2 parents 6d2333f + c1d10cb commit 176a6d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/tz.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
|
*/

'timezone' => env('TIMEZONE', 'Asia/Karachi'),
'timezone' => env('TIMEZONE', 'UTC'),
];
2 changes: 2 additions & 0 deletions tests/Feature/TZConversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public function it_converts_utc_time_to_asked_timezone()

$model = TestModel::factory()->create(['created_at' => $UTCDateTime]);

config(['tz.timezone' => 'Asia/Karachi']);

$asiaKarachiTZ = Carbon::parse($UTCDateTime)
->addHours(5)->format('Y-m-d H:i:s'); // UTC (+5) [Asia/Karachi]

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public function tz_config_file_is_present()
public function it_has_key_timezone()
{
$configTimezone = config('tz.timezone');
$this->assertEquals('Asia/Karachi', $configTimezone);
$this->assertEquals('UTC', $configTimezone);
}
}

0 comments on commit 176a6d0

Please sign in to comment.