code: def date_to_json(pydate, manager):
      
      if pydate is None:
          return None
      else:
          return dict(
              year=pydate.year,
              month=pydate.month - 1,  # Months are 0-based indices in JS
              date=pydate.day
          )
docs: Serialize a Python date object.
  
      Attributes of this dictionary are to be passed to the JavaScript Date
      constructor.