File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
interactions/models/discord Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,15 @@ def astimezone(self, tz: tzinfo | None = None) -> "Timestamp":
99
99
if self .year > 1970 or (self .year == 1970 and (self .month > 1 or self .day > 1 )):
100
100
return super ().astimezone (tz )
101
101
102
- if self .year < 1969 or self .month < 12 or self .day < 31 :
102
+ if self .year < 1969 or ( self .year == 1969 and ( self . month < 12 or self .day < 31 )) :
103
103
# windows kind of breaks down for dates before unix time
104
104
# technically this is solvable, but it's not worth the effort
105
105
# also, again, this is a loose bound, but it's good enough for our purposes
106
106
raise ValueError ("astimezone with no arguments is not supported for dates before Unix Time on Windows." )
107
107
108
+ if tz :
109
+ return self .replace (tzinfo = tz )
110
+
108
111
# to work around the issue to some extent, we'll use a timestamp with a date
109
112
# that doesn't trigger the bug, and use the timezone from it to modify this
110
113
# timestamp
You can’t perform that action at this time.
0 commit comments