fix timestamp_friends: ignore ordinal suffixes (st/nd/rd/th) in bare-hour regex

This commit is contained in:
esef committed 2026-07-23 23:45:04 +03:00
1 parent c485c4f6bf
commit b51967dc9b
1 file changed
+1 -1
+1 -1
View File
@@ -27,7 +27,7 @@ def has_ampm(text: str) -> bool:
# in "3:00") and NOT followed by colon (excludes "3:00" hours). Captures
# an optional am/pm suffix separately.
_HOUR_RE = re.compile(
r"(?<!:)\b(\d{1,2})(?!\d)(?!\s*:)(?:\s*(am|a\.m\.?|pm|p\.m\.?))?",
r"(?<!:)\b(\d{1,2})(?!\d)(?!st\b|nd\b|rd\b|th\b)(?!\s*:)(?:\s*(am|a\.m\.?|pm|p\.m\.?))?",
re.IGNORECASE,
)