Skip to content

Fix incorrect regex pattern in time_duration_is_valid function#247

Open
prjanitor wants to merge 1 commit intoCouncilDataProject:mainfrom
prjanitor:prjanitor/5e4483fb2273726d94b8b11b34d6521c2de4ec24
Open

Fix incorrect regex pattern in time_duration_is_valid function#247
prjanitor wants to merge 1 commit intoCouncilDataProject:mainfrom
prjanitor:prjanitor/5e4483fb2273726d94b8b11b34d6521c2de4ec24

Conversation

@prjanitor
Copy link
Copy Markdown

Summary

Fixed a malformed regex pattern in the time_duration_is_valid function that prevented valid time duration strings from being accepted.

Changes

  • Updated the regex pattern from ^((((\d{1,2}:)?[0-5])?\d:)?[0-5])?\d$ to ^\d{1,2}:\d{2}:\d{2}$
  • The new pattern correctly validates HH:MM:SS format with:
    • 1-2 digits for hours
    • Exactly 2 digits for minutes
    • Exactly 2 digits for seconds

Testing

Valid formats now accepted:

  • 1:23:45
  • 12:34:56
  • 0:00:00

Invalid formats correctly rejected:

  • 1:2:3 (single digit minutes/seconds)
  • 123:45:67 (too many digits)
  • 12:34 (missing seconds)

This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

The previous regex pattern was malformed and did not correctly validate
HH:MM:SS time duration format. The new pattern properly validates:
- 1-2 digits for hours
- Colon separator
- Exactly 2 digits for minutes
- Colon separator
- Exactly 2 digits for seconds
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