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

parse_date behavior change in version 0.7.2 #92

Open
KaworuNagisa-fr opened this issue Oct 14, 2024 · 1 comment
Open

parse_date behavior change in version 0.7.2 #92

KaworuNagisa-fr opened this issue Oct 14, 2024 · 1 comment

Comments

@KaworuNagisa-fr
Copy link

Hello,

I noticed a change in the way parse_date works in the last release. Previously, using parse_date with a datetime string worked, returning only the date part :

>>> import isodate
>>> dt = '2024-10-11T13:00:00'
>>> isodate.parse_date(dt)
datetime.date(2024, 10, 11)

This was very useful when working with a module like FullCalendar which returns date strings OR datetime strings according to the view.

In the last version, this no longer works :

>>> import isodate
>>> dt = '2024-10-11T13:00:00'
>>> isodate.parse_date(dt)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Env\Pyramid_crit_py312\Lib\site-packages\isodate\isodates.py", line 194, in parse_date
    raise ISO8601Error("Unrecognised ISO 8601 date format: %r" % datestring)
isodate.isoerror.ISO8601Error: Unrecognised ISO 8601 date format: '2024-10-11T13:00:00'

The cause being the new "add_re" function which adds "\A" and "\Z" at the start and end of the regexes.

def add_re(regex_text):
    cache_entry.append(re.compile(r"\A" + regex_text + r"\Z"))

Removing the "\Z" fixes the issue.

Maybe this is intentional, though...

Thanks a lot

@santiagoblancov
Copy link

This issue has broken a library:
mvantellingen/python-zeep#1431

Thank you in advance.

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

No branches or pull requests

2 participants