Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date handling #1

Open
redhog opened this issue Oct 13, 2021 · 0 comments
Open

Date handling #1

redhog opened this issue Oct 13, 2021 · 0 comments

Comments

@redhog
Copy link
Member

redhog commented Oct 13, 2021

Broken/missing dates break parsing. To fix:

https://github.com/emerald-geomodelling/libgeosuiteprv/blob/master/libgeosuiteprv/__init__.py#L32

should change into

'date': parse_date(firstline_list[2]),

and

def parse_date(v):
    try:
        if len(v) >= 8:
            return dateutil.parser.isoparse(v).date()
    except ValueError as exception:
        logger.debug("Unable to parse date as iso %s: %s" % (v, exception))
    try:
        return dateutil.parser.parse(v, parserinfo=dateutil.parser.parserinfo(dayfirst=True)).date()
    except Exception as e:
        logger.debug("Unable to parse date %s: %s" %(v,e))
        return v

should be added (see libsgfdata for similar code)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant