Skip to content

Commit ebd3c28

Browse files
committed
Deprecates create_from_date() and create_from_time()
1 parent 6f2a2bf commit ebd3c28

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Deprecated
1010

1111
- `with_date()` and `with_time()` are deprecated. Use `on()` and `at()` instead.
12+
- `create_from_date()` and `create_from_time()` are deprecated. Use `create()` instead.
1213

1314

1415
## [0.7.0] - 2016-12-07

pendulum/pendulum.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,14 @@ def create_from_date(cls, year=None, month=None, day=None, tz='UTC'):
391391
392392
:rtype: Pendulum
393393
"""
394+
warnings.warn(
395+
'create_from_date() is deprecated. '
396+
'It will be removed in the next major version. '
397+
'Use create(year, month, day) instead.',
398+
category=DeprecationWarning,
399+
stacklevel=2
400+
)
401+
394402
return cls.create(year, month, day, tz=tz)
395403

396404
@classmethod
@@ -408,6 +416,14 @@ def create_from_time(cls, hour=0, minute=0, second=0,
408416
409417
:rtype: Pendulum
410418
"""
419+
warnings.warn(
420+
'create_from_time() is deprecated. '
421+
'It will be removed in the next major version. '
422+
'Use create(hour=hour, minute=minute, second=second) instead.',
423+
category=DeprecationWarning,
424+
stacklevel=2
425+
)
426+
411427
return cls.now(tz).replace(
412428
hour=hour, minute=minute, second=second,
413429
microsecond=microsecond

0 commit comments

Comments
 (0)