Comments (1)
Looks like the issue is from underlying pendulum parser.
Python 3.11.5 (main, Aug 24 2023, 12:23:19) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from maya import parse
>>> dt = "june 15,1987"
>>> parse(dt)
<MayaDT epoch=1686787200.0>
>>> parse(dt).datetime()
datetime.datetime(2023, 6, 15, 0, 0, tzinfo=<UTC>)
>>> from pendulum import parse
>>> parse(dt)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/santhoshsolomon/Desktop/venv/lib/python3.11/site-packages/pendulum/parser.py", line 29, in parse
return _parse(text, **options)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santhoshsolomon/Desktop/venv/lib/python3.11/site-packages/pendulum/parser.py", line 45, in _parse
parsed = base_parse(text, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santhoshsolomon/Desktop/venv/lib/python3.11/site-packages/pendulum/parsing/__init__.py", line 74, in parse
return _normalize(_parse(text, **_options), **_options)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santhoshsolomon/Desktop/venv/lib/python3.11/site-packages/pendulum/parsing/__init__.py", line 128, in _parse
raise ParserError("Unable to parse string [{}]".format(text))
pendulum.parsing.exceptions.ParserError: Unable to parse string [june 15,1987]
When pendulum parser is failing, I have tried with other underlying tools, dateparser and python-dateutils.
>>> from dateparser import parse as dp_parse
>>> dt = "june 15,1987"
>>> dp_parse(dt)
datetime.datetime(1987, 6, 15, 0, 0) # correct value
>>> from dateutil.parser import parse as du_parse
>>> du_parse(dt)
datetime.datetime(2023, 6, 15, 0, 0) # wrong value
So the issue is happening at fallback parser python-dateutil.
Library versions
>>>
>>> import maya
>>> print(maya.__version__)
0.6.1
>>> import dateutil
>>> print(dateutil.__version__)
2.8.2
>>> import dateparser
>>> print(dateparser.__version__)
1.2.0
>>> import pendulum
>>> print(pendulum.__version__)
2.1.2
Added upstream issue at
- dateutils - dateutil/dateutil#1321
- pendulum - sdispater/pendulum#770
from maya.
Related Issues (20)
- maya.intervals returns an infinite generator HOT 1
- 'regex._regex_core'; 'regex' is not a package HOT 3
- pip3 install maya doesn't install out of the box in python slim docker container. HOT 3
- Not friendly to Chinese HOT 2
- Inconsistency between date and datetime HOT 9
- UnicodeDecodeError with pip install maya on Windows 10 HOT 2
- Reference document for acceptable date formats HOT 2
- Fix simple typo: quanitzed -> quantized
- BST O! what a mess
- dateparser >=0.7.5 is not compatible with Python 2.7 HOT 1
- maya.parse fails on certain dates.
- Package not compatible with next version of tzlocal HOT 1
- Architecture not supported - Mac OS 10.15 in pipenv
- AttributeError: 'MayaDT' object has no attribute 'snap_tz' HOT 1
- Looking for a new maintainer HOT 3
- Invalid date format - %Y\%m\%d
- day_first parse when year_first format does nothing? HOT 1
- Test failure with Python 3.12 HOT 2
- transfer back to @kennethreitz HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maya.