Skip to content

Commit 5bd4a1d

Browse files
authored
Merge pull request #887 from Secrus/fromtimestamp-fix
Fix DeprecationWarning for timezone-aware fromtimestamp
2 parents dcd9816 + 038d115 commit 5bd4a1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pendulum/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def from_timestamp(timestamp: int | float, tz: str | Timezone = UTC) -> DateTime
286286
"""
287287
Create a DateTime instance from a timestamp.
288288
"""
289-
dt = _datetime.datetime.utcfromtimestamp(timestamp)
289+
dt = _datetime.datetime.fromtimestamp(timestamp, tz=UTC)
290290

291291
dt = datetime(
292292
dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond

0 commit comments

Comments
 (0)