MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / applyTimestampDefaults

Function applyTimestampDefaults

src/core/createCompat.ts:92–112  ·  view source on GitHub ↗
(
	frontmatter: UnknownRecord,
	mapping: SpecFieldMapping,
	taskType: TaskTypeDefLike | undefined,
	now: Date
)

Source from the content-addressed store, hash-verified

90}
91
92function 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
114function applyFieldDefaults(frontmatter: UnknownRecord, taskType: TaskTypeDefLike | undefined): void {
115 const fields = taskType?.fields;

Callers 1

createTaskWithCompatFunction · 0.85

Calls 2

resolveFieldFunction · 0.90
hasValueFunction · 0.85

Tested by

no test coverage detected