Skip to content

Commit 1d71460

Browse files
committed
Fix wrong value returned by tzname() for the UTC timezone
1 parent 5b06241 commit 1d71460

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- Fixed an offset error when subtracting datetimes in the same timezone.
8+
- Fixed wrong value returned by `tzname()` for the UTC timezone
89

910

1011
## [1.4.1] - 2018-02-05

pendulum/tz/timezone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def __getinitargs__(self):
518518
class _UTC(FixedTimezone):
519519

520520
def __init__(self):
521-
super(_UTC, self).__init__(0, 'UTC', TransitionType(0, False, 'GMT'))
521+
super(_UTC, self).__init__(0, 'UTC', TransitionType(0, False, 'UTC'))
522522

523523
UTC._tz = self
524524

tests/tz_tests/test_timezone.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,9 @@ def test_fixed_timezone(self):
379379

380380
self.assertEqual(tz2.utcoffset(dt).total_seconds(), 18000)
381381
self.assertIsNone(tz2.dst(dt))
382+
383+
def test_utc_tzname(self):
384+
tz = Timezone.load('UTC')
385+
dt = datetime(2016, 11, 26)
386+
387+
assert tz.tzname(dt) == 'UTC'

0 commit comments

Comments
 (0)