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

Unexpected date parsing #434

Closed
piskvorky opened this issue May 2, 2017 · 2 comments · Fixed by #655
Closed

Unexpected date parsing #434

piskvorky opened this issue May 2, 2017 · 2 comments · Fixed by #655
Labels

Comments

@piskvorky
Copy link

piskvorky commented May 2, 2017

Weird bugs were tracked to Arrow parsing dates incorrectly (and silently):

import arrow
arrow.__version__
# 0.10.0
arrow.get('2016')
# <Arrow [1970-01-01T00:33:36+00:00]>

Is that expected/intended? What is Arrow interpreting the string 2016 as?

Also, this was not what I expected:

arrow.get('05/02/2017', ['YYYY', 'MM/DD/YYYY'])
# <Arrow [2017-01-01T00:00:00+00:00]>
arrow.get('05/02/2017', ['MM/DD/YYYY', 'YYYY'])
# <Arrow [2017-05-02T00:00:00+00:00]>

Format order matters, and if order wrong, produce silent errors?

@pganssle
Copy link
Contributor

pganssle commented May 2, 2017 via email

@hosseinmoein
Copy link

I have another example that indicates arrow doing greedy matching and producing wrong results:

arrow.get('Jun-2019', ['MMM-YY', 'MMM-YYYY'])
<Arrow [2020-06-01T00:00:00+00:00]>

arrow.get('Jun-2019', ['MMM-YYYY', 'MMM-YY'])
<Arrow [2019-06-01T00:00:00+00:00]>

In the first example it matches incorrectly with MMM-YY.
But if you put MMM-YYYY first, than it matches with the correct pattern

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

Successfully merging a pull request may close this issue.

4 participants