docs: def to_iso_datetime(dt):
      '''
      Format a date or datetime into an ISO-8601 datetime string.
  
      Time is set to 00:00:00 for dates.
  
      Support dates before 1900.
      '''
      if dt:
          date_str = to_iso_date(dt)
          time_str = '{dt.hour:02d}:{dt.minute:02d}:{dt.second:02d}'.format(
              dt=dt) if isinstance(dt, datetime) else '00:00:00'
          return 'T'.join((date_str, time_str))