INNER CODE UNIT · Python

CustomDateFormat

eamigo86/graphene-django-extras · graphene_django_extras/base_types.py:158

class CustomDateFormat(object):
    """Custom date format wrapper."""

    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):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…