File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -207,16 +207,19 @@ def _get_rc_timezone():
207
207
208
208
def _to_ordinalf (dt ):
209
209
"""
210
- Convert :mod:`datetime` or :mod:`date ` to the Gregorian date as UTC float
211
- days, preserving hours, minutes, seconds and microseconds. Return value
212
- is a :func:`float`.
210
+ Convert :mod:`datetime`, :mod:`date` or :mod:`timedelta ` to the Gregorian
211
+ date as UTC float days, preserving hours, minutes, seconds and
212
+ microseconds. Return value is a :func:`float`.
213
213
"""
214
214
# Convert to UTC
215
215
tzi = getattr (dt , 'tzinfo' , None )
216
216
if tzi is not None :
217
217
dt = dt .astimezone (UTC )
218
218
tzi = UTC
219
219
220
+ if isinstance (dt , datetime .timedelta ):
221
+ return dt .total_seconds () / SEC_PER_DAY
222
+
220
223
base = float (dt .toordinal ())
221
224
222
225
# If it's sufficiently datetime-like, it will have a `date()` method
You can’t perform that action at this time.
0 commit comments