Skip to content

Commit b4fd497

Browse files
committed
BUG: expand if check for Linux
1 parent 2aa90a0 commit b4fd497

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/_libs/tslibs/conversion.pyx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ cimport numpy as cnp
55
from numpy cimport int64_t, int32_t, intp_t, ndarray
66
cnp.import_array()
77

8-
from dateutil import zoneinfo
8+
from dateutil.zoneinfo import tzfile as du_tzfile1
9+
from dateutil.tz.tz import tzfile as du_tzfile2
910

1011
import pytz
1112

@@ -365,7 +366,10 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz,
365366
else:
366367
obj.value = pydatetime_to_dt64(ts, &obj.dts)
367368
# GH 24329 Take DST offset into account
368-
if isinstance(ts.tzinfo, zoneinfo.tzfile):
369+
# Two check in if necessary because class
370+
# differs on Windows and Linux
371+
if (isinstance(ts.tzinfo, du_tzfile1) or
372+
isinstance(ts.tzinfo, du_tzfile2)):
369373
if ts.tzinfo.is_ambiguous(ts):
370374
dst_offset = ts.tzinfo.dst(ts)
371375
obj.value += int(dst_offset.total_seconds() * 1e9)

0 commit comments

Comments
 (0)