Skip to content

Commit

Permalink
Ensure GraphQL always returns dates in UTC.
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Feb 6, 2025
1 parent 8d88ddf commit baff33d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Feature/GraphQL/Fieldtypes/DateFieldtypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function setUp(): void
#[Test]
public function it_gets_dates()
{
// Set the timezone. We want to ensure the date is always returned in UTC.
config()->set('app.timezone', 'America/New_York'); // -05:00
date_default_timezone_set('America/New_York');

// Set the to string format so can see it uses that rather than a coincidence.
// But reset it afterwards.
$originalFormat = Carbon::getToStringFormat();
Expand Down

0 comments on commit baff33d

Please sign in to comment.