| 124 | } |
| 125 | |
| 126 | function checkDateFields( |
| 127 | fm: ParsedFrontmatter, |
| 128 | issues: ValidationIssue[] |
| 129 | ): void { |
| 130 | for (const name of DATE_FIELDS) { |
| 131 | const field = fm.fields.get(name); |
| 132 | if (!field) continue; |
| 133 | |
| 134 | const val = field.value; |
| 135 | if (val === null || val === undefined || val === "") continue; |
| 136 | |
| 137 | // The YAML parser may parse dates as Date objects — that's valid |
| 138 | if (val instanceof Date) continue; |
| 139 | |
| 140 | if (typeof val !== "string" || !DATE_REGEX.test(val)) { |
| 141 | issues.push({ |
| 142 | severity: "error", |
| 143 | message: `'${name}' must be a valid date in YYYY-MM-DD format`, |
| 144 | field: name, |
| 145 | target: "value", |
| 146 | }); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | function checkVerifySteps( |
| 152 | fm: ParsedFrontmatter, |