MCPcopy Create free account
hub / github.com/driangle/taskmd / checkDateFields

Function checkDateFields

apps/vscode/src/validate.ts:126–149  ·  view source on GitHub ↗
(
  fm: ParsedFrontmatter,
  issues: ValidationIssue[]
)

Source from the content-addressed store, hash-verified

124}
125
126function 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
151function checkVerifySteps(
152 fm: ParsedFrontmatter,

Callers 1

validateFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected