Skip to content

Commit feaa62a

Browse files
committed
Merge branch 'master' into develop
2 parents 42b4743 + b7da758 commit feaa62a

File tree

7 files changed

+52
-14
lines changed

7 files changed

+52
-14
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
- Formatting (with f-strings or `format()`) will now use the configured formatter.
1414

1515

16+
## [1.0.2]
17+
18+
### Changed
19+
20+
- Adds support for external tzinfo as timezones. (Thanks to [iv597](https://github.com/iv597))
21+
22+
### Fixed
23+
24+
- Fixed `day_of_year` not returning the correct value. (Thanks to [asrenzo](https://github.com/asrenzo))
25+
26+
1627
## [1.0.1]
1728

1829
### Fixed
@@ -321,7 +332,9 @@ This version causes major breaking API changes to simplify it and making it more
321332
Initial release
322333

323334

324-
[Unreleased]: https://github.com/sdispater/pendulum/compare/1.0.1...develop
335+
336+
[Unreleased]: https://github.com/sdispater/pendulum/compare/1.0.2...develop
337+
[1.0.2]: https://github.com/sdispater/pendulum/releases/tag/1.0.2
325338
[1.0.1]: https://github.com/sdispater/pendulum/releases/tag/1.0.1
326339
[1.0.0]: https://github.com/sdispater/pendulum/releases/tag/1.0.0
327340
[0.8.0]: https://github.com/sdispater/pendulum/releases/tag/0.8.0

README.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
Pendulum
22
########
33

4+
.. image:: https://img.shields.io/pypi/v/pendulum.svg
5+
:target: https://pypi.python.org/pypi/pendulum
6+
7+
.. image:: https://img.shields.io/pypi/l/pendulum.svg
8+
:target: https://pypi.python.org/pypi/pendulum
9+
10+
.. image:: https://img.shields.io/codecov/c/github/sdispater/pendulum/master.svg
11+
:target: https://codecov.io/gh/sdispater/pendulum/branch/master
12+
413
.. image:: https://travis-ci.org/sdispater/pendulum.png
5-
:alt: Pendulum Build status
6-
:target: https://travis-ci.org/sdispater/pendulum
14+
:alt: Pendulum Build status
15+
:target: https://travis-ci.org/sdispater/pendulum
716

817
Python datetimes made easy.
918

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# The short X.Y version.
6161
version = '1.0'
6262
# The full version, including alpha/beta/rc tags.
63-
release = '1.0.1'
63+
release = '1.0.2'
6464

6565
# The language for content autogenerated by Sphinx. Refer to documentation
6666
# for a list of supported languages.

pendulum/pendulum.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,11 @@ def _safe_create_datetime_zone(cls, obj):
7070
elif isinstance(obj, datetime.tzinfo) and not isinstance(obj, Timezone):
7171
# pytz
7272
if hasattr(obj, 'localize'):
73-
obj = obj.zone
74-
else:
75-
# We have no sure way to figure out
76-
# the timezone name, we raise an error
77-
78-
raise ValueError('Unsupported timezone {}'.format(obj))
73+
return cls._timezone(obj.zone)
7974

80-
tz = cls._timezone(obj)
75+
return FixedTimezone(obj.utcoffset(None).total_seconds())
8176

82-
return tz
77+
return cls._timezone(obj)
8378

8479
@classmethod
8580
def _local_timezone(cls):

pendulum/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
VERSION = '1.0.1'
3+
VERSION = '1.0.2'

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@ def build_extension(self, ext):
9191
'Intended Audience :: Developers',
9292
'Operating System :: OS Independent',
9393
'Programming Language :: Python',
94-
'Topic :: Software Development :: Libraries :: Python Modules',
94+
'Programming Language :: Python :: 2.7',
95+
'Programming Language :: Python :: 3',
96+
'Programming Language :: Python :: 3.2',
97+
'Programming Language :: Python :: 3.3',
98+
'Programming Language :: Python :: 3.4',
99+
'Programming Language :: Python :: 3.5',
100+
'Programming Language :: Python :: 3.6',
101+
'Programming Language :: Python :: Implementation :: CPython',
102+
'Programming Language :: Python :: Implementation :: PyPy'
95103
],
96104
)
97105

tests/pendulum_tests/test_timezone.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# -*- coding: utf-8 -*-
22

3+
import sys
34
from pendulum import Pendulum
45

56
from .. import AbstractTestCase
67

8+
if sys.version_info >= (3, 2):
9+
from datetime import timedelta, timezone
10+
711

812
class TimezoneTest(AbstractTestCase):
913

@@ -36,3 +40,12 @@ def test_astimezone(self):
3640
d = d.astimezone('Europe/Paris')
3741
self.assertEqual('Europe/Paris', d.timezone_name)
3842
self.assertPendulum(d, now.year, now.month, now.day, now.hour + 1, now.minute)
43+
44+
if sys.version_info >= (3, 2):
45+
d = d.astimezone(timezone.utc)
46+
self.assertEqual('+00:00', d.timezone_name)
47+
self.assertPendulum(d, now.year, now.month, now.day, now.hour, now.minute)
48+
49+
d = d.astimezone(timezone(timedelta(hours=-8)))
50+
self.assertEqual('-08:00', d.timezone_name)
51+
self.assertPendulum(d, now.year, now.month, now.day, now.hour - 8, now.minute)

0 commit comments

Comments
 (0)