Skip to content

Support (YYYY-MM-dd) placeholder token in date validation for template files #130

@WilliamBerryiii

Description

@WilliamBerryiii

Summary

The Validate-MarkdownFrontmatter.ps1 script should accept (YYYY-MM-dd) as a valid token for the ms.date field in template files, in addition to actual ISO 8601 dates.

Problem

Template files (e.g., ADR templates, documentation templates) use placeholder tokens like (YYYY-MM-dd) in the frontmatter to indicate where actual dates should be inserted when the template is used. Currently, the validation script only accepts dates matching the pattern ^\d{4}-\d{2}-\d{2}$, causing warnings for template files.

Current behavior:

Invalid date format in: docs/templates/adr-template-solutions.md. Expected YYYY-MM-DD (ISO 8601), got: (YYYY-MM-dd)

Proposed Solution

Update the date validation logic in Validate-MarkdownFrontmatter.ps1 to:

  1. Accept (YYYY-MM-dd) as a valid placeholder token for template files
  2. Optionally detect template files by path pattern (e.g., **/templates/**) or filename pattern (e.g., *-template*.md)

Suggested Implementation

Modify the date validation regex from:

if ($date -notmatch '^\d{4}-\d{2}-\d{2}$') {

To also accept the placeholder pattern:

if ($date -notmatch '^(\d{4}-\d{2}-\d{2}|\(YYYY-MM-dd\))$') {

Files Affected

  • scripts/linting/Validate-MarkdownFrontmatter.ps1 - Lines 482-485 and 572-577

Acceptance Criteria

  • (YYYY-MM-dd) is accepted as a valid date token
  • Actual ISO 8601 dates (2025-12-05) continue to work
  • Template files in **/templates/** directories pass validation
  • No breaking changes to existing validation behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions