Skip to content

Parser cannot handle common datetime format used in image metadata #1446

@fizbin

Description

@fizbin

EXIF metadata on JPEG (and other) images uses this format for datetime values: YYYY:MM:DD HH:mm:SS; eg 2025:03:29 07:19:05.

When fed to dateutil.parser.parse, this format doesn't behave as expected:

In [69]: dateutil.parser.parse('2024:03:29 07:19:05', fuzzy_with_tokens=True)
Out[69]: (datetime.datetime(2025, 11, 28, 7, 19, 5), (' ',))

Note the presence here of bug #1063 as well. It wouldn't be so bad if the tokens returned with fuzzy_with_tokens made explicit the fact that the date portion is being ignored.

Also, there is no indication (when fuzzy is not passed to the parser) that the parse has been anything other than perfectly successful:

In [79]: dateutil.parser.parse('2024:03:29 07:19:05')
Out[79]: datetime.datetime(2025, 11, 28, 7, 19, 5)

I would expect here either either the correct data or a ParserError raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions