Skip to content

from_format spanish cause error (copied from google examples) #971

@daniv

Description

@daniv
  • [ X] I am on the latest Pendulum version.
  • [ X] I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name:
  • Pendulum version:

Issue

pendulum.from_format("15 de enero de 2026", "DD [de] MMMM [de] YYYY", locale="es")

File "C:\Users\solma\PycharmProjects\miloto-add.venv\Lib\site-packages\pendulum_init_.py", line 279, in from_format
parts = formatter.parse(string, fmt, now(tz=tz), locale=locale)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\PycharmProjects\miloto-add.venv\Lib\site-packages\pendulum\formatting\formatter.py", line 408, in parse
if not re.fullmatch(pattern, time):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_init
.py", line 172, in fullmatch
return compile(pattern, flags).fullmatch(string)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_init
.py", line 307, in _compile
p = _compiler.compile(pattern, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_compiler.py", line 745, in compile
p = _parser.parse(p, flags)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_parser.py", line 979, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_parser.py", line 460, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solma\AppData\Local\Programs\Python\Python312\Lib\re_parser.py", line 857, in _parse
raise source.error(err.msg, len(name) + 1) from None
re.error: redefinition of group name 'd' as group 4; was group 2 at position 140

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions