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
Babel cannot parse its own format? #541
Comments
Hi @nagylzs 👋 I took the liberty of splitting your code into three segments for easier readability :) It looks like there's a minor problem with Windows there with the first exception; there is no Anyway, the It looks like there's a more full-fledged library available for parsing various human-readable date formats, called (aptly enough) |
Babel also works fine with format='short'. I have been using python-dateutil before (dateutil.parser.parse) with short formats. I swtiched to babel because it could format dates with month names. I will look at dateparser. But first: would it be a good contribution to change babel's parse_date method, and add support for parsing (short and long) month names? It does not seem to be a hard problem: month names are already in babel, we just need to look for them. |
I just tested dateparser and well, it cannot be beaten. 🥇 I can do things like converting "today" or "one month ago" or even "két héttel ezelőtt" (meaning: "two weeks ago"). All of them are converted to the correct date and time. This is truly amazing! |
I just ran into a similar issue when running programs that use babel from monit.
Setting LC_TIME or one of the other env vars before babel is imported fixes the issue but it's annoying none the less. |
@LPiner This seems to be an unrelated issue, but anyway – I'd expect a "sanely" configured system to have some locale set up if it expects to format things in a locale-dependent way :) |
Since @nagylzs found a solution, closing this issue :) |
I had this same issue (AttributeError: 'NoneType' object has no attribute 'date_formats') when running my flask application on Google App Engine Standard and calling on the web app to display a table (using the flask_table module) containing a DatetimeCol with a UTC date. Setting the LC_TIME environment variable in the Google App Engine environment (via the app.yaml file) fixed the problem. This thread proved very helpful...thank you! |
@cbirger Same issue with me running Pycharm on my dev win10 machine, wonder if its on babel's side or my os's |
The text was updated successfully, but these errors were encountered: