Date Format Check

This rule enforces consistent date formatting according to the Google Developer Documentation Style Guide. It flags dates that don't follow the preferred format of "Month DD, YYYY" (e.g., "July 31, 2016"). Consistent date formatting is crucial for clarity and reduces confusion, especially in international contexts where different date formats are common.

Examples:

✗ Incorrect formats that will be flagged:

  • 31.07.2016
  • 07/31/2016
  • 31 July 2016

✓ Correct format:

  • July 31, 2016

The rule specifically catches:

  1. Dates using periods or slashes (e.g., 31.07.2016, 07/31/2016)
  2. Dates in the format "DD Month YYYY" (e.g., 31 July 2016)
  3. Works with both full month names (July) and abbreviated versions (Jul)

When triggered, it will suggest converting the date to the preferred "Month DD, YYYY" format.

Rule Source

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

Rule Definition

extends: existence
message: "Use 'July 31, 2016' format, not '%s'."
link: 'https://developers.google.com/style/dates-times'
ignorecase: true
level: error
nonword: true
tokens:
  - '\d{1,2}(?:\.|/)\d{1,2}(?:\.|/)\d{4}'
  - '\d{1,2} (?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)|May|Jun(?:e)|Jul(?:y)|Aug(?:ust)|Sep(?:tember)?|Oct(?:ober)|Nov(?:ember)?|Dec(?:ember)?) \d{4}'