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":
9999 if self .year > 1970 or (self .year == 1970 and (self .month > 1 or self .day > 1 )):
100100 return super ().astimezone (tz )
101101
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 )) :
103103 # windows kind of breaks down for dates before unix time
104104 # technically this is solvable, but it's not worth the effort
105105 # also, again, this is a loose bound, but it's good enough for our purposes
106106 raise ValueError ("astimezone with no arguments is not supported for dates before Unix Time on Windows." )
107107
108+ if tz :
109+ return self .replace (tzinfo = tz )
110+
108111 # to work around the issue to some extent, we'll use a timestamp with a date
109112 # that doesn't trigger the bug, and use the timezone from it to modify this
110113 # timestamp
You can’t perform that action at this time.
0 commit comments