# Path: src/pycrunchbase/resource/utils.py
# def parse_date(datelike):
#     """Helper for parsing dates in Organization properties"""
#     try:
#         return datetime.strptime(datelike, "%Y-%m-%d")
#     except ValueError:
#         return datelike


import six
from .node import Node
from .utils import parse_date



@six.python_2_unicode_compatible
class News(Node):
    """Represents a News on CrunchBase"""

    KNOWN_PROPERTIES = [
        "title",
        "author",
        "posted_on",
        "url",
        "created_at",
        "updated_at",
    ]

    def _coerce_values(self):
        for attr in ['posted_on']:
            if getattr(self, attr, None):

# Path: src/pycrunchbase/resource/utils.py
# def parse_date(datelike):
#     """Helper for parsing dates in Organization properties"""
#     try:
#         return datetime.strptime(datelike, "%Y-%m-%d")
#     except ValueError:
#         return datelike


# Path: src/pycrunchbase/resource/news.py
import six
from .node import Node
from .utils import parse_date




@six.python_2_unicode_compatible
class News(Node):
    """Represents a News on CrunchBase"""

    KNOWN_PROPERTIES = [
        "title",
        "author",
        "posted_on",
        "url",
        "created_at",
        "updated_at",
    ]

    def _coerce_values(self):
        for attr in ['posted_on']:
            if getattr(self, attr, None):

                setattr(self, attr, parse_date(getattr(self, attr)))