Skip to content

Parse explicit time patterns without minutes - #1474

Open
Twiink wants to merge 1 commit into
python-babel:masterfrom
Twiink:fix/parse-hour-only-time
Open

Twiink wants to merge 1 commit into
python-babel:masterfrom
Twiink:fix/parse-hour-only-time

Conversation

@Twiink

@Twiink Twiink commented Nov 18, 2026

Copy link
Copy Markdown

An explicit pattern such as HH, H時 or h a can format an hour successfully but cannot parse the resulting string. parse_time assumes that every pattern contains a minute field. Track its optional position just as we do for seconds and read the available fields independently. This also permits an explicit seconds-and-hours pattern to round-trip.

Four public format_time / parse_time regressions failed on master. The full local suite passed with 8,220 passed, 4 skipped and 2 expected failures. Ruff lint passed on the two touched files.

This branch has not been deployed

No deployments
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.

1 participant