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
Contructor issue with non-None timezone #658
Comments
Hello @mafycek, I don't understand what you mean, please can you provide a reproducible example. |
Hey thanks for reporting this. Like Chris said, it would be great to have an example input that causes Arrow to fail so we can write a regression test :). |
Hi guys, import arrow
import dateparser
date_that_succeds = "1990-01-01T00:00:00"
date_that_fails = "1990-01-01T00:00:00+00:00"
for date in [date_that_succeds, date_that_fails]:
try:
parsed_date = dateparser.parse(date, date_formats=None or ['%d %B %Y', '%d/%m/%y', '%d/%m/%Y', '%d.%m.%Y'])
arrow_date = arrow.get(parsed_date)
print(date_that_succeded, arrow_date)
except:
print("It failed on date " + date) Results: Explanation of the failure: My comment: Regression for this case would be really needed. Well, it could test more that one timezone and take into account some special ones with non-integer shifts. Bye, |
Colleague of mine fixed unnecessary stuff and typo. However the message is the same: import arrow
import dateparser
date_that_succeeds = "1990-01-01T00:00:00"
date_that_fails = "1990-01-01T00:00:00+00:00"
for date in [date_that_succeeds, date_that_fails]:
try:
parsed_date = dateparser.parse(date, date_formats=['%d %B %Y', '%d/%m/%y', '%d/%m/%Y', '%d.%m.%Y'])
arrow_date = arrow.get(parsed_date)
print(date, arrow_date)
except:
print("It failed on date " + date) |
Thanks @mafycek, we will do some digging on this bug and look at fixes. Useful note, you can wrap python code blocks like this. ```python |
Constructor of Arrow object (arrow.py) fails if tzinfo is non-None and if it does not contain field "zone".
The problematic part:
should be like
The change came since version 0.14.5
The text was updated successfully, but these errors were encountered: