code: def daterange_end(value):
      '''Parse a date range end boundary'''
      if not value:
          return None
      elif isinstance(value, datetime):
          return value.date()
      elif isinstance(value, date):
          return value
  
      result = parse_dt(value).date()
      dashes = value.count('-')
  
      if dashes >= 2:
          # Full date
          return result
      elif dashes == 1:
          # Year/Month
          return result + relativedelta(months=+1, days=-1, day=1)
      else:
          # Year only
          return result.replace(month=12, day=31f daterange_end(value):
      '''Parse a date range end boundary'''
      if not value:
          return None
      elif isinstance(value, datetime):
          return value.date()
      elif isinstance(value, date):
          return value
  
      result = parse_dt(value).date()
      dashes = value.count('-')
  
      if dashes >= 2:
          # Full date
          return result
      elif dashes == 1:
          # Year/Month
          return result + relativedelta(months=+1, days=-1, day=1)
      else:
          # Year only
          return result.replace(month=12, day=31)
docs: Parse a date range end boundary