INNER CODE UNIT · Python
__init__
eamigo86/graphene-django-extras · graphene_django_extras/base_types.py:161
def __init__(self, date):
"""Initialize custom date format."""
self.date_str = date
class CustomTime(Time):
"""Custom time scalar type with support for custom date formats."""
@staticmethod
def serialize(time):
"""Serialize time value to string."""
if isinstance(time, CustomDateFormat):
return time.date_str
if isinstance(time, datetime.datetime):
time = time.time()
assert isinstance(