8000
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 51a5ab0 commit 3d18de8Copy full SHA for 3d18de8
lib/matplotlib/dates.py
@@ -252,18 +252,15 @@ def _dt64_to_ordinalf(d):
252
because we do times compared to ``0001-01-01T00:00:00`` (plus one day).
253
"""
254
255
- zerod = False
256
- if isinstance(d, np.datetime64):
257
- zerod = True
258
- d = np.atleast_1d(d)
+ # the "extra" ensures that we at least allow the dynamic range out to
+ # seconds. That should get out to +/-2e11 years.
259
extra = d - d.astype('datetime64[s]')
260
extra = extra.astype('timedelta64[ns]')
261
t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]')
262
dt = (d.astype('datetime64[s]') - t0).astype(np.float64)
263
dt += extra.astype(np.float64) / 1.0e9
264
dt = dt / SEC_PER_DAY + 1.0
265
- if zerod:
266
- dt = dt[0]
+
267
return dt
268
269
0 commit comments