Time Format AM/PM Rule

This rule enforces consistent formatting of AM/PM time indicators in text. It ensures that AM/PM designations follow proper style guidelines, requiring a space before "AM" or "PM" and using capital letters. This standardization improves readability and maintains professional consistency in documentation, following Microsoft Style Guide conventions.

Examples

✗ Incorrect usage:

  • "The meeting is at 9AM"
  • "Submit by 5pm"
  • "Office opens at 8a.m."
  • "Closes at 6P.M."

✓ Correct usage:

  • "The meeting is at 9 AM"
  • "Submit by 5 PM"
  • "Office opens at 8 AM"
  • "Closes at 6 PM"

The rule flags any instances where:

  1. AM/PM is directly attached to numbers without a space
  2. Lowercase variations (am/pm) are used
  3. Periods are used in the time designation (a.m./p.m.)

Rule Source

This rule comes from: https://github.com/mesosphere/dcos-docs-site

Rule Definition

extends: existence
message: Use 'AM' or 'PM' (preceded by a space).
link: https://docs.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/term-collections/date-time-terms
level: error
nonword: true
tokens:
  - '\d{1,2}[AP]M'
  - '\d{1,2} ?[ap]m'
  - '\d{1,2} ?[aApP]\.[mM]\.'