Skip to content

Commit

Permalink
Fix calculation where a date loses a timezone
Browse files Browse the repository at this point in the history
closes #45
  • Loading branch information
has2k1 committed Jul 26, 2024
1 parent 1a3fd20 commit 5381c8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ v0.12.0
-------

API Changes
-----------
***********

- mizani now requires python 3.9 and above.

Bug Fixes
*********

- Fixed bug where a date with a timezone could lose the timezone. :issue:`45`.


v0.11.4
-------
*2024-05-24*
Expand Down
6 changes: 5 additions & 1 deletion mizani/_core/date_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ def floor_day(d: datetime) -> datetime:
"""
Round down to the start of the day
"""
return d.min.replace(d.year, d.month, d.day) if has_time(d) else d
return (
d.min.replace(d.year, d.month, d.day, tzinfo=d.tzinfo)
if has_time(d)
else d
)


def ceil_day(d: datetime) -> datetime:
Expand Down

0 comments on commit 5381c8c

Please sign in to comment.