Skip to content

Comments

Handle blank PO-Revision-Date and POT-Creation-Date headers#1258

Open
bysiber wants to merge 1 commit intopython-babel:masterfrom
bysiber:fix-blank-revision-date
Open

Handle blank PO-Revision-Date and POT-Creation-Date headers#1258
bysiber wants to merge 1 commit intopython-babel:masterfrom
bysiber:fix-blank-revision-date

Conversation

@bysiber
Copy link

@bysiber bysiber commented Feb 21, 2026

When a PO file has a blank PO-Revision-Date header (e.g. generated by Poedit), _parse_datetime_header crashes with a ValueError because it tries to parse an empty string with strptime.

ValueError: time data '' does not match format '%Y-%m-%d %H:%M'

This adds a value.strip() check before calling _parse_datetime_header for both PO-Revision-Date and POT-Creation-Date headers. When the value is blank, the catalog keeps its existing defaults instead of crashing.

Fixes #1219

When a PO file has a blank PO-Revision-Date or POT-Creation-Date
header (e.g. generated by Poedit), _parse_datetime_header raises
a ValueError because it cannot parse an empty string.

Skip parsing when the header value is blank, preserving the
catalog's existing default values instead of crashing.
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

Successfully merging this pull request may close these issues.

Exception raised if the revision date is blank

1 participant