( frontmatter: UnknownRecord, mapping: SpecFieldMapping, taskType: TaskTypeDefLike | undefined, now: Date )
| 90 | } |
| 91 | |
| 92 | function applyTimestampDefaults( |
| 93 | frontmatter: UnknownRecord, |
| 94 | mapping: SpecFieldMapping, |
| 95 | taskType: TaskTypeDefLike | undefined, |
| 96 | now: Date |
| 97 | ): void { |
| 98 | const fields = taskType?.fields; |
| 99 | if (!fields) return; |
| 100 | |
| 101 | const nowIso = now.toISOString(); |
| 102 | |
| 103 | const createdField = resolveField(mapping, "dateCreated"); |
| 104 | if (fields[createdField] && !hasValue(frontmatter[createdField])) { |
| 105 | frontmatter[createdField] = nowIso; |
| 106 | } |
| 107 | |
| 108 | const modifiedField = resolveField(mapping, "dateModified"); |
| 109 | if (fields[modifiedField] && !hasValue(frontmatter[modifiedField])) { |
| 110 | frontmatter[modifiedField] = nowIso; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | function applyFieldDefaults(frontmatter: UnknownRecord, taskType: TaskTypeDefLike | undefined): void { |
| 115 | const fields = taskType?.fields; |
no test coverage detected