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

maya.parse fails on certain dates. #190

Open
eannam opened this issue Sep 12, 2020 · 0 comments
Open

maya.parse fails on certain dates. #190

eannam opened this issue Sep 12, 2020 · 0 comments

Comments

@eannam
Copy link

eannam commented Sep 12, 2020

maya.parse throws an error when attempting to parse certain ISO string dates.

Example:

maya.parse("Mon, 02 Mar 2020 00:00:00 GMT")

Working Examples:
maya.parse("Wed, 02 Sep 2020 00:00:00 GMT")
<MayaDT epoch=1599004800.0>

maya.parse("Tue, 01 Sep 2020 00:00:00 GMT")
<MayaDT epoch=1598918400.0>

  File "<stdin>", line 1, in <module>
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/maya/core.py", line 766, in parse
    dt = pendulum.parse(str(string), **options)
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/pendulum/parser.py", line 29, in parse
    return _parse(text, **options)
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/pendulum/parser.py", line 56, in _parse
    tz=parsed.tzinfo or options.get("tz", UTC),
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/pendulum/__init__.py", line 111, in datetime
    tz = _safe_timezone(tz)
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/pendulum/__init__.py", line 82, in _safe_timezone
    elif obj.tzname(None) == "UTC":
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/dateutil/tz/tz.py", line 238, in tzname
    return self._tznames[self._isdst(dt)]
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/dateutil/tz/tz.py", line 291, in _isdst
    dstval = self._naive_is_dst(dt)
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/dateutil/tz/tz.py", line 259, in _naive_is_dst
    timestamp = _datetime_to_timestamp(dt)
  File "/Users/eanna/.local/share/virtualenvs/yo-_4WEwAWG/lib/python3.7/site-packages/dateutil/tz/tz.py", line 1814, in _datetime_to_timestamp
    return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
AttributeError: 'NoneType' object has no attribute 'replace'

Environment and Version

  • OS (incl. terminal and shell used): Mac OS Catalina 10.15.6
  • Python Version: 3.7
  • maya Version: 0.6.1
  • Your timezone: British Summer Time
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