AM/PM Time Format Rule

This rule enforces consistent formatting of time expressions using AM and PM indicators. It ensures that time expressions follow a standard format where "AM" and "PM" are capitalized and preceded by a space, which improves readability and maintains professional consistency in documentation.

What It Checks For

The rule flags time expressions that:

  • Have AM/PM directly attached to numbers without a space (e.g., "2PM")
  • Use lowercase "am" or "pm"
  • Use periods in A.M. or P.M.

Examples

Will flag these incorrect formats:

2PM       ❌
3:15pm    ❌
10A.M.    ❌

Should be written as:

2 PM      ✅
3:15 PM   ✅
10 AM     ✅

The rule helps maintain consistency with the Google Developer Documentation Style Guide and ensures time expressions are clear and professional across all documentation.

Rule Source

This rule comes from: https://github.com/jump-dev/JuMP.jl

Rule Definition

extends: existence
message: "Use 'AM' or 'PM' (preceded by a space)."
link: 'https://developers.google.com/style/word-list'
level: error
nonword: true
tokens:
  - '\d{1,2}[AP]M'
  - '\d{1,2} ?[ap]m'
  - '\d{1,2} ?[aApP]\.[mM]\.'