Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b0d94b commit ba623a7Copy full SHA for ba623a7
lib/matplotlib/dates.py
@@ -215,12 +215,16 @@ def _to_ordinalf(dt):
215
if delta is not None:
216
dt -= delta
217
218
- base = dt.toordinal()
219
- td_remainder = (dt-datetime.datetime.fromordinal(base)).total_seconds()
+ # Get a datetime object at midnight in the same time zone as dt.
+ cdate = dt.date()
220
+ midnight_time = datetime.time(0, 0, 0, tzinfo=dt.tzinfo)
221
- base = float(base)
222
+ rdt = datetime.datetime.combine(cdate, midnight_time)
223
+ td_remainder = (dt-rdt).total_seconds()
224
+
225
+ base = float(dt.toordinal())
226
if td_remainder > 0:
- base ++ td_remainder / SEC_PER_DAY
227
+ base += td_remainder / SEC_PER_DAY
228
229
return base
230
0 commit comments