mostrar fecha correcta en markdown

This commit is contained in:
Cat /dev/Nulo 2024-09-11 22:14:55 -03:00
parent fbf3cb8d88
commit 0d58e66b38

View file

@ -17,13 +17,14 @@ export async function generateMarkdown() {
})) }))
.sort((a, b) => +b.date - +a.date); .sort((a, b) => +b.date - +a.date);
let latestResources = new Map<string, Resource>(); let latestResources = new Map<string, Resource & { firstSeenAt: Date }>();
for (const { date, resources } of datasetsArray) { for (const { date, resources } of datasetsArray) {
for (const resource of resources) { for (const resource of resources) {
const id = `${resource.id}-revID-${resource.revision_id}`; const id = `${resource.id}-revID-${resource.revision_id}`;
if (latestResources.has(id)) continue; const existing = latestResources.get(id);
latestResources.set(id, resource); if (existing && existing.firstSeenAt < date) continue;
latestResources.set(id, { ...resource, firstSeenAt: date });
} }
} }
@ -133,7 +134,7 @@ esto esta automáticamente generado por sepa-index-gen dentro de preciazo.`;
warnings += warnings +=
"⁉️⚠️ dia de semana incorrecto, puede haberse subido incorrectamente "; "⁉️⚠️ dia de semana incorrecto, puede haberse subido incorrectamente ";
} }
markdown += `\n * ${id} ${warnings} ${fileExists ? `[✅ descargar](${link})` : "❌"} (${dateTimeFormatter.format(resource.modified)})`; markdown += `\n * ${id} ${warnings} ${fileExists ? `[✅ descargar](${link})` : "❌"} (primera vez visto: ${dateTimeFormatter.format(resource.firstSeenAt)})`;
} }
} }