1

Date et heure complète à la création d'un fichier

This commit is contained in:
2025-12-01 01:15:24 +01:00
parent 19952fec1f
commit 87211c9cc3
3 changed files with 40 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ const path = require('path');
const https = require('https');
const readline = require('readline');
const { loadToolsConfig } = require('./lib/config');
const { formatDateTime } = require('./lib/datetime');
const ROOT = process.cwd();
const LEGO_ROOT = path.join(ROOT, 'content', 'collections', 'lego');
@@ -366,8 +367,7 @@ async function main() {
const indexExists = fsSync.existsSync(indexPath);
if (!indexExists) {
const pageTitle = setDetails.name || selected.name;
const today = new Date();
const date = today.toISOString().slice(0, 10);
const createdAt = formatDateTime();
// Collect images present in imagesDir (existing or just downloaded)
let imageFiles = [];
@@ -417,7 +417,7 @@ async function main() {
const coverLine = coverFile ? `cover: images/${coverFile}\n` : '';
const md = `---\n` +
`title: "${pageTitle.replace(/"/g, '\\"')}"\n` +
`date: ${date}\n` +
`date: ${createdAt}\n` +
coverLine +
`---\n\n` +
body;