question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Babel cannot parse its own format?

See original GitHub issue
import babel.dates
import datetime

today = datetime.datetime.today()
formatted = babel.dates.format_date(today, locale='hu')
print(repr(formatted))
'2017. nov. 11.'
babel.dates.parse_date(formatted)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python34-32\lib\site-packages\babel\dates.py", line 1144, in parse_date
    format = get_date_format(locale=locale).pattern.lower()
  File "C:\Users\User\AppData\Local\Programs\Python\Python34-32\lib\site-packages\babel\dates.py", line 378, in get_date_format
    return Locale.parse(locale).date_formats[format]
AttributeError: 'NoneType' object has no attribute 'date_formats'
babel.dates.parse_date(formatted, locale='hu')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python34-32\lib\site-packages\babel\dates.py", line 1165, in parse_date
    day = int(numbers[indexes['D']])
IndexError: list index out of range

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nagylzscommented, Nov 11, 2017

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!

0reactions
mattkizcommented, Aug 25, 2018

@cbirger Same issue with me running Pycharm on my dev win10 machine, wonder if its on babel’s side or my os’s

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/parser
The Babel parser (previously Babylon) is a JavaScript parser used in Babel. The latest ECMAScript version enabled by default (ES2020). Comment attachment.
Read more >
Stop babel parse and generate reformatting output code
I need to do this while retaining the javascript's formatting but it's re-formatting it. I can't see anything else in the options for...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Learn how to use Rollup as a smaller, more efficient alternative to webpack and Browserify to bundle JavaScript files in this step-by-step tutorial...
Read more >
Babel Documentation - Read the Docs
Remember to test your code to make sure it behaves as desired. 1.5.3 Parsing Numbers. Babel can also parse numeric data in a...
Read more >
rollup.js
It uses the new standardized format for code modules included in the ES6 ... Imported values cannot be reassigned, though imported objects and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found