Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the names of timezones #2871

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/Carbon/SerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testDateSerializationReflectionCompatibility()

@$reflection->date = '1990-01-17 10:28:07';
@$reflection->timezone_type = 3;
@$reflection->timezone = 'US/Pacific';
@$reflection->timezone = 'America/Los_Angeles';

$date = unserialize(serialize($reflection));
} catch (Throwable $exception) {
Expand All @@ -118,7 +118,7 @@ public function testDateSerializationReflectionCompatibility()

@$reflection->date = '1990-01-17 10:28:07';
@$reflection->timezone_type = 3;
@$reflection->timezone = 'US/Pacific';
@$reflection->timezone = 'America/Los_Angeles';

$date = unserialize(serialize($reflection));

Expand Down Expand Up @@ -146,7 +146,7 @@ public function testDateSerializationReflectionCompatibility()

$setValue('date', '1990-01-17 10:28:07');
$setValue('timezone_type', 3);
$setValue('timezone', 'US/Pacific');
$setValue('timezone', 'America/Los_Angeles');

$date = unserialize(serialize($target));

Expand Down
10 changes: 5 additions & 5 deletions tests/Carbon/TestingAidsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function testCreateFromPartialFormat()
$this->assertSame('2013-09-01T10:20:30-07:00', Carbon::createFromFormat('H:i:s', '10:20:30')->toIso8601String());

// Custom timezone.
$this->assertSame('2013-09-01T10:20:00+03:00', Carbon::createFromFormat('H:i e', '10:20 Europe/Kiev')->toIso8601String());
$this->assertSame('2013-09-01T10:20:00+03:00', Carbon::createFromFormat('H:i e', '10:20 Europe/Kyiv')->toIso8601String());
$this->assertSame('2013-09-01T10:20:00+01:00', Carbon::createFromFormat('H:i', '10:20', 'Europe/London')->toIso8601String());
$this->assertSame('2013-09-01T11:30:00+07:00', Carbon::createFromFormat('H:i:s e', '11:30:00+07:00')->toIso8601String());
$this->assertSame('2013-09-01T11:30:00+05:00', Carbon::createFromFormat('H:i:s', '11:30:00', '+05:00')->toIso8601String());
Expand All @@ -266,17 +266,17 @@ public function testCreateFromPartialFormat()

// Resetting to epoch (timezone fun).
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('|', '')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('e|', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('e|', 'Europe/Kyiv')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+01:00', Carbon::createFromFormat('|', '', 'Europe/London')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('!', '')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('!e', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('!e', 'Europe/Kyiv')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+01:00', Carbon::createFromFormat('!', '', 'Europe/London')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('e!', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('e!', 'Europe/Kyiv')->toIso8601String());

// Escaped epoch resets.
$this->assertSame('2013-09-01T05:10:15-07:00', Carbon::createFromFormat('\|', '|')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15-07:00', Carbon::createFromFormat('\!', '!')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15+03:00', Carbon::createFromFormat('e \!', 'Europe/Kiev !')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15+03:00', Carbon::createFromFormat('e \!', 'Europe/Kyiv !')->toIso8601String());
}

public function testCreateFromPartialFormatWithMicroseconds()
Expand Down
10 changes: 5 additions & 5 deletions tests/CarbonImmutable/SerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testDateSerializationReflectionCompatibility()

@$reflection->date = '1990-01-17 10:28:07';
@$reflection->timezone_type = 3;
@$reflection->timezone = 'US/Pacific';
@$reflection->timezone = 'America/Los_Angeles';

$date = unserialize(serialize($reflection));
} catch (Throwable $exception) {
Expand All @@ -115,7 +115,7 @@ public function testDateSerializationReflectionCompatibility()

@$reflection->date = '1990-01-17 10:28:07';
@$reflection->timezone_type = 3;
@$reflection->timezone = 'US/Pacific';
@$reflection->timezone = 'America/Los_Angeles';

$date = unserialize(serialize($reflection));

Expand Down Expand Up @@ -143,7 +143,7 @@ public function testDateSerializationReflectionCompatibility()

$setValue('date', '1990-01-17 10:28:07');
$setValue('timezone_type', 3);
$setValue('timezone', 'US/Pacific');
$setValue('timezone', 'America/Los_Angeles');

$date = unserialize(serialize($target));

Expand Down Expand Up @@ -214,12 +214,12 @@ public function testWakeupRawMethod(): void

@$date->date = '1990-01-17 10:28:07';
@$date->timezone_type = 3;
@$date->timezone = 'US/Pacific';
@$date->timezone = 'America/Los_Angeles';
@$date->dumpLocale = 'es';

$date->__wakeup();

$this->assertSame('1990-01-17 10:28:07 US/Pacific', $date->format('Y-m-d H:i:s e'));
$this->assertSame('1990-01-17 10:28:07 America/Los_Angeles', $date->format('Y-m-d H:i:s e'));
$this->assertSame('es', $date->locale);
}

Expand Down
10 changes: 5 additions & 5 deletions tests/CarbonImmutable/TestingAidsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function testCreateFromPartialFormat()
$this->assertSame('2013-09-01T10:20:30-07:00', Carbon::createFromFormat('H:i:s', '10:20:30')->toIso8601String());

// Custom timezone.
$this->assertSame('2013-09-01T10:20:00+03:00', Carbon::createFromFormat('H:i e', '10:20 Europe/Kiev')->toIso8601String());
$this->assertSame('2013-09-01T10:20:00+03:00', Carbon::createFromFormat('H:i e', '10:20 Europe/Kyiv')->toIso8601String());
$this->assertSame('2013-09-01T10:20:00+01:00', Carbon::createFromFormat('H:i', '10:20', 'Europe/London')->toIso8601String());
$this->assertSame('2013-09-01T11:30:00+07:00', Carbon::createFromFormat('H:i:s e', '11:30:00+07:00')->toIso8601String());
$this->assertSame('2013-09-01T11:30:00+05:00', Carbon::createFromFormat('H:i:s', '11:30:00', '+05:00')->toIso8601String());
Expand All @@ -240,17 +240,17 @@ public function testCreateFromPartialFormat()

// Resetting to epoch (timezone fun).
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('|', '')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('e|', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('e|', 'Europe/Kyiv')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+01:00', Carbon::createFromFormat('|', '', 'Europe/London')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('!', '')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('!e', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+03:00', Carbon::createFromFormat('!e', 'Europe/Kyiv')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00+01:00', Carbon::createFromFormat('!', '', 'Europe/London')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('e!', 'Europe/Kiev')->toIso8601String());
$this->assertSame('1970-01-01T00:00:00-08:00', Carbon::createFromFormat('e!', 'Europe/Kyiv')->toIso8601String());

// Escaped epoch resets.
$this->assertSame('2013-09-01T05:10:15-07:00', Carbon::createFromFormat('\|', '|')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15-07:00', Carbon::createFromFormat('\!', '!')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15+03:00', Carbon::createFromFormat('e \!', 'Europe/Kiev !')->toIso8601String());
$this->assertSame('2013-09-01T05:10:15+03:00', Carbon::createFromFormat('e \!', 'Europe/Kyiv !')->toIso8601String());

Carbon::setTestNow('2023-12-05 21:09:54');
$this->assertSame('2023-12-05 15:00:00.000000', Carbon::createFromFormat('H', '15')->format('Y-m-d H:i:s.u'));
Expand Down
2 changes: 1 addition & 1 deletion tests/CarbonTimeZone/ConversionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testToOffsetNameFromDifferentCreationMethods()
$summer = Carbon::parse('2020-06-15');
$winter = Carbon::parse('2018-12-20');
$this->assertSame('+02:00', (new CarbonTimeZone('Europe/Paris'))->toOffsetName());
$this->assertSame('+05:30', (new CarbonTimeZone('Asia/Calcutta'))->toOffsetName());
$this->assertSame('+05:30', (new CarbonTimeZone('Asia/Kolkata'))->toOffsetName());
$this->assertSame('+13:45', CarbonTimeZone::create('Pacific/Chatham')->toOffsetName($winter));
$this->assertSame('+12:00', CarbonTimeZone::create('Pacific/Auckland')->toOffsetName($summer));
$this->assertSame('-05:15', CarbonTimeZone::createFromHourOffset(-5.25)->toOffsetName());
Expand Down
Loading