code: def _parse_date_input(date_input, default_offset=0):
      
      if date_input:
          try:
              return parse_date_input(date_input)
          except ValueError as err:
              raise CommandError(force_text(err))
      else:
          return get_midnight() - timedelta(days=default_offset)
docs: Parses a date input.